Skip to content

Commit

Permalink
Add logo to main window and icon to all windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
aussig committed Apr 2, 2024
1 parent 9d68724 commit 8616890
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## v3.7.0 - xxxx-xx-xx

### New Features:

* Add logo to main window and all window icons

### Changes:

* Added new logo as avatar for all posts.
Expand Down
Binary file added assets/logo_bgstally.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo_bgstally_100x67.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo_bgstally_16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo_bgstally_32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 14 additions & 13 deletions bgstally/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def __init__(self, bgstally):
self.bgstally = bgstally
self.frame = None

self.image_logo_bgstally_100 = PhotoImage(file = path.join(self.bgstally.plugin_dir, FOLDER_ASSETS, "logo_bgstally_100x67.png"))
self.image_logo_bgstally_16 = PhotoImage(file = path.join(self.bgstally.plugin_dir, FOLDER_ASSETS, "logo_bgstally_16x16.png"))
self.image_logo_bgstally_32 = PhotoImage(file = path.join(self.bgstally.plugin_dir, FOLDER_ASSETS, "logo_bgstally_32x32.png"))
self.image_blank = PhotoImage(file = path.join(self.bgstally.plugin_dir, FOLDER_ASSETS, "blank.png"))
self.image_button_dropdown_menu = PhotoImage(file = path.join(self.bgstally.plugin_dir, FOLDER_ASSETS, "button_dropdown_menu.png"))
self.image_button_cmdrs = PhotoImage(file = path.join(self.bgstally.plugin_dir, FOLDER_ASSETS, "button_cmdrs.png"))
Expand Down Expand Up @@ -71,35 +74,33 @@ def shut_down(self):
"""


def get_plugin_frame(self, parent_frame:tk.Frame):
def get_plugin_frame(self, parent_frame: tk.Frame) -> tk.Frame:
"""
Return a TK Frame for adding to the EDMC main window
"""
self.frame = tk.Frame(parent_frame)
self.frame: tk.Frame = tk.Frame(parent_frame)

current_row = 0
tk.Label(self.frame, text="BGS Tally").grid(row=current_row, column=0, sticky=tk.W)
current_row: int = 0
tk.Label(self.frame, image=self.image_logo_bgstally_100).grid(row=current_row, column=0, rowspan=3, sticky=tk.W)
self.label_version = HyperlinkLabel(self.frame, text=f"v{str(self.bgstally.version)}", background=nb.Label().cget('background'), url=URL_LATEST_RELEASE, underline=True)
self.label_version.grid(row=current_row, column=1, columnspan=3 if self.bgstally.capi_fleetcarrier_available() else 2, sticky=tk.W)
current_row += 1
tk.Label(self.frame, text="BGS Tally Status:" + " " + self.bgstally.state.Status.get()).grid(row=current_row, column=1, sticky=tk.W)
current_row += 1
self.label_tick = tk.Label(self.frame, text="Last BGS Tick:" + " " + self.bgstally.tick.get_formatted())
self.label_tick.grid(row=current_row, column=1, sticky=tk.W)
current_row += 1
self.button_latest_tick: tk.Button = tk.Button(self.frame, text="Latest BGS Tally", height=SIZE_BUTTON_PIXELS-2, image=self.image_blank, compound=tk.RIGHT, command=partial(self._show_activity_window, self.bgstally.activity_manager.get_current_activity()))
self.button_latest_tick.grid(row=current_row, column=0, padx=3)
self.button_previous_ticks: tk.Button = tk.Button(self.frame, text="Previous BGS Tallies ", height=SIZE_BUTTON_PIXELS-2, image=self.image_button_dropdown_menu, compound=tk.RIGHT, command=self._previous_ticks_popup)
self.button_previous_ticks.grid(row=current_row, column=1, padx=3)
self.button_previous_ticks.grid(row=current_row, column=1, padx=3, sticky=tk.W)
tk.Button(self.frame, image=self.image_button_cmdrs, height=SIZE_BUTTON_PIXELS, width=SIZE_BUTTON_PIXELS, command=self._show_cmdr_list_window).grid(row=current_row, column=2, padx=3)
if self.bgstally.capi_fleetcarrier_available():
self.button_carrier: tk.Button = tk.Button(self.frame, image=self.image_button_carrier, state=('normal' if self.bgstally.fleet_carrier.available() else 'disabled'), height=SIZE_BUTTON_PIXELS, width=SIZE_BUTTON_PIXELS, command=self._show_fc_window)
self.button_carrier.grid(row=current_row, column=3, padx=3)
else:
self.button_carrier: tk.Button = None
current_row += 1
tk.Label(self.frame, text="BGS Tally Status:").grid(row=current_row, column=0, sticky=tk.W)
tk.Label(self.frame, textvariable=self.bgstally.state.Status).grid(row=current_row, column=1, sticky=tk.W)
current_row += 1
tk.Label(self.frame, text="Last BGS Tick:").grid(row=current_row, column=0, sticky=tk.W)
self.label_tick: tk.Label = tk.Label(self.frame, text=self.bgstally.tick.get_formatted())
self.label_tick.grid(row=current_row, column=1, sticky=tk.W)
current_row += 1

return self.frame

Expand All @@ -115,7 +116,7 @@ def update_plugin_frame(self):
else:
self.label_version.configure(text=f"v{str(self.bgstally.version)}", url=URL_LATEST_RELEASE, foreground='blue')

self.label_tick.config(text=self.bgstally.tick.get_formatted())
self.label_tick.config(text="Last BGS Tick:" + " " + self.bgstally.tick.get_formatted())
self.button_latest_tick.config(command=partial(self._show_activity_window, self.bgstally.activity_manager.get_current_activity()))
if self.button_carrier is not None:
self.button_carrier.config(state=('normal' if self.bgstally.fleet_carrier.available() else 'disabled'))
Expand Down
8 changes: 4 additions & 4 deletions bgstally/windows/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class WindowActivity:

def __init__(self, bgstally, ui, activity: Activity):
self.bgstally = bgstally
self.ui = ui
self.activity:Activity = activity
self.toplevel:tk.Toplevel = None
self.window_geometry:dict = None
Expand All @@ -47,13 +46,14 @@ def show(self, activity: Activity):
self._store_window_geometry()
self.toplevel.destroy()

self.toplevel = tk.Toplevel(self.ui.frame)
self.toplevel = tk.Toplevel(self.bgstally.ui.frame)
self.toplevel.title(f"{self.bgstally.plugin_name} - Activity After Tick at: {activity.get_title()}")
self.toplevel.protocol("WM_DELETE_WINDOW", self._window_closed)
self.toplevel.iconphoto(False, self.bgstally.ui.image_logo_bgstally_32, self.bgstally.ui.image_logo_bgstally_16)

if self.window_geometry is not None:
self.toplevel.geometry(f"+{self.window_geometry['x']}+{self.window_geometry['y']}")

self.toplevel.title(f"{self.bgstally.plugin_name} - Activity After Tick at: {activity.get_title()}")

ContainerFrame = ttk.Frame(self.toplevel)
ContainerFrame.pack(fill=tk.BOTH, expand=tk.YES)
Expand Down Expand Up @@ -305,7 +305,7 @@ def _show_legend_window(self, event):
"""
Display a mini-window showing a legend of all icons used
"""
self.ui.show_legend_window()
self.bgstally.ui.show_legend_window()


def _discord_button_available(self) -> bool:
Expand Down
1 change: 1 addition & 0 deletions bgstally/windows/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def show(self, parent_frame:tk.Frame = None):
if parent_frame is None: parent_frame = self.bgstally.ui.frame
self.toplevel = tk.Toplevel(parent_frame)
self.toplevel.title(f"{self.bgstally.plugin_name} - API Settings")
self.toplevel.iconphoto(False, self.bgstally.ui.image_logo_bgstally_32, self.bgstally.ui.image_logo_bgstally_16)
self.toplevel.resizable(False, False)

if sys.platform == 'win32':
Expand Down
1 change: 1 addition & 0 deletions bgstally/windows/cmdrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def show(self):

self.toplevel = tk.Toplevel(self.bgstally.ui.frame)
self.toplevel.title("CMDR Interactions")
self.toplevel.iconphoto(False, self.bgstally.ui.image_logo_bgstally_32, self.bgstally.ui.image_logo_bgstally_16)
self.toplevel.geometry("1200x800")

container_frame = ttk.Frame(self.toplevel)
Expand Down
1 change: 1 addition & 0 deletions bgstally/windows/fleetcarrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def show(self):

self.toplevel = tk.Toplevel(self.bgstally.ui.frame)
self.toplevel.title(f"Carrier {fc.name} ({fc.callsign}) in system: {fc.data['currentStarSystem']}")
self.toplevel.iconphoto(False, self.bgstally.ui.image_logo_bgstally_32, self.bgstally.ui.image_logo_bgstally_16)
self.toplevel.geometry("600x800")

container_frame:ttk.Frame = ttk.Frame(self.toplevel)
Expand Down
1 change: 1 addition & 0 deletions bgstally/windows/legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def show(self):

self.toplevel = tk.Toplevel(self.bgstally.ui.frame)
self.toplevel.title(f"{self.bgstally.plugin_name} - Icon Legend")
self.toplevel.iconphoto(False, self.bgstally.ui.image_logo_bgstally_32, self.bgstally.ui.image_logo_bgstally_16)
self.toplevel.resizable(False, False)

frame_container:ttk.Frame = ttk.Frame(self.toplevel)
Expand Down

0 comments on commit 8616890

Please sign in to comment.