mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-05 18:03:17 +03:00
Tidy plugin widget creation.
So that widgets are created in logical tab-traversal order.
This commit is contained in:
parent
c8e7d42b00
commit
4e9f875567
@ -87,41 +87,32 @@ class AppWindow:
|
|||||||
|
|
||||||
frame = ttk.Frame(self.w, name=appname.lower())
|
frame = ttk.Frame(self.w, name=appname.lower())
|
||||||
frame.grid(sticky=tk.NSEW)
|
frame.grid(sticky=tk.NSEW)
|
||||||
rows = 4
|
|
||||||
plugin_items = list()
|
|
||||||
for plugname in plug.PLUGINS:
|
|
||||||
appitem = plug.get_plugin_app(plugname, frame)
|
|
||||||
if appitem:
|
|
||||||
plugin_items.append(appitem)
|
|
||||||
|
|
||||||
rows += len(plugin_items)
|
|
||||||
|
|
||||||
frame.columnconfigure(1, weight=1)
|
frame.columnconfigure(1, weight=1)
|
||||||
frame.rowconfigure(rows, weight=1)
|
|
||||||
|
|
||||||
ttk.Label(frame, text=_('Cmdr')+':').grid(row=0, column=0, sticky=tk.W) # Main window
|
ttk.Label(frame, text=_('Cmdr')+':').grid(row=0, column=0, sticky=tk.W) # Main window
|
||||||
ttk.Label(frame, text=_('System')+':').grid(row=1, column=0, sticky=tk.W) # Main window
|
ttk.Label(frame, text=_('System')+':').grid(row=1, column=0, sticky=tk.W) # Main window
|
||||||
ttk.Label(frame, text=_('Station')+':').grid(row=2, column=0, sticky=tk.W) # Main window
|
ttk.Label(frame, text=_('Station')+':').grid(row=2, column=0, sticky=tk.W) # Main window
|
||||||
|
|
||||||
nextrow = 3
|
|
||||||
for plugin_item in plugin_items:
|
|
||||||
plugin_item.grid(row=nextrow, column=0, sticky=tk.W)
|
|
||||||
nextrow += 1
|
|
||||||
|
|
||||||
self.cmdr = ttk.Label(frame, width=-21)
|
self.cmdr = ttk.Label(frame, width=-21)
|
||||||
self.system = HyperlinkLabel(frame, compound=tk.RIGHT, url = self.system_url, popup_copy = True)
|
self.system = HyperlinkLabel(frame, compound=tk.RIGHT, url = self.system_url, popup_copy = True)
|
||||||
self.station = HyperlinkLabel(frame, url = self.station_url, popup_copy = lambda x: x!=self.STATION_UNDOCKED)
|
self.station = HyperlinkLabel(frame, url = self.station_url, popup_copy = lambda x: x!=self.STATION_UNDOCKED)
|
||||||
self.button = ttk.Button(frame, name='update', text=_('Update'), command=self.getandsend, default=tk.ACTIVE, state=tk.DISABLED) # Update button in main window
|
|
||||||
self.status = ttk.Label(frame, name='status', width=-25)
|
|
||||||
self.w.bind('<Return>', self.getandsend)
|
|
||||||
self.w.bind('<KP_Enter>', self.getandsend)
|
|
||||||
|
|
||||||
self.cmdr.grid(row=0, column=1, sticky=tk.EW)
|
self.cmdr.grid(row=0, column=1, sticky=tk.EW)
|
||||||
self.system.grid(row=1, column=1, sticky=tk.EW)
|
self.system.grid(row=1, column=1, sticky=tk.EW)
|
||||||
self.station.grid(row=2, column=1, sticky=tk.EW)
|
self.station.grid(row=2, column=1, sticky=tk.EW)
|
||||||
|
|
||||||
self.button.grid(row=nextrow + 1, column=0, columnspan=2, sticky=tk.NSEW)
|
for plugname in plug.PLUGINS:
|
||||||
self.status.grid(row=nextrow + 2, column=0, columnspan=2, sticky=tk.EW)
|
appitem = plug.get_plugin_app(plugname, frame)
|
||||||
|
if appitem:
|
||||||
|
appitem.grid(columnspan=2, sticky=tk.W)
|
||||||
|
|
||||||
|
self.button = ttk.Button(frame, name='update', text=_('Update'), command=self.getandsend, default=tk.ACTIVE, state=tk.DISABLED) # Update button in main window
|
||||||
|
self.status = ttk.Label(frame, name='status', width=-25)
|
||||||
|
self.button.grid(columnspan=2, sticky=tk.NSEW)
|
||||||
|
self.status.grid(columnspan=2, sticky=tk.EW)
|
||||||
|
|
||||||
|
self.w.bind('<Return>', self.getandsend)
|
||||||
|
self.w.bind('<KP_Enter>', self.getandsend)
|
||||||
|
|
||||||
for child in frame.winfo_children():
|
for child in frame.winfo_children():
|
||||||
child.grid_configure(padx=5, pady=(platform=='darwin' and 3 or 2))
|
child.grid_configure(padx=5, pady=(platform=='darwin' and 3 or 2))
|
||||||
|
12
prefs.py
12
prefs.py
@ -218,7 +218,11 @@ class PreferencesDialog(tk.Toplevel):
|
|||||||
_('Keyboard shortcut') or # Tab heading in settings on OSX
|
_('Keyboard shortcut') or # Tab heading in settings on OSX
|
||||||
_('Hotkey')) # Tab heading in settings on Windows
|
_('Hotkey')) # Tab heading in settings on Windows
|
||||||
|
|
||||||
|
# build plugin prefs tabs
|
||||||
|
for plugname in plug.PLUGINS:
|
||||||
|
plugframe = plug.get_plugin_pref(plugname, notebook)
|
||||||
|
if plugframe:
|
||||||
|
notebook.add(plugframe, text=plugname)
|
||||||
|
|
||||||
if platform=='darwin':
|
if platform=='darwin':
|
||||||
self.protocol("WM_DELETE_WINDOW", self.apply) # close button applies changes
|
self.protocol("WM_DELETE_WINDOW", self.apply) # close button applies changes
|
||||||
@ -238,12 +242,6 @@ class PreferencesDialog(tk.Toplevel):
|
|||||||
# disable hotkey for the duration
|
# disable hotkey for the duration
|
||||||
hotkeymgr.unregister()
|
hotkeymgr.unregister()
|
||||||
|
|
||||||
# build plugin prefs tabs
|
|
||||||
for plugname in plug.PLUGINS:
|
|
||||||
plugframe = plug.get_plugin_pref(plugname, notebook)
|
|
||||||
if plugframe:
|
|
||||||
notebook.add(plugframe, text=plugname)
|
|
||||||
|
|
||||||
# wait for window to appear on screen before calling grab_set
|
# wait for window to appear on screen before calling grab_set
|
||||||
self.wait_visibility()
|
self.wait_visibility()
|
||||||
self.grab_set()
|
self.grab_set()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user