Show toolbar tooltips.

libgui/GuiGeneralFrame.py:_initToolBars(): pass label to wx.ToolBar.Add{,Radio}Tool().
libgui/GuiGeneralFrame.py: minor cleanup.
assets/text/TODO: updated.
This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-04 16:09:46 +02:00
parent c81275bf2f
commit d193120312
2 changed files with 32 additions and 43 deletions

View File

@ -1,12 +1,12 @@
1) General {cleanup,refactor} 1) General {cleanup,refactor}
2) Incremental auto{load,save} & {backup,restore} 2) Incremental auto{load,save} & {backup,restore}
3) Open and toggle a reference image in the background 3) GUI: a) scrollbar b) switch from wxPython to GTK
4) Client-Server or Peer-to-Peer realtime collaboration 4) Open and toggle a reference image in the background
5) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.) 5) Client-Server or Peer-to-Peer realtime collaboration
6) Hotkey & graphical interfaces to {composed,parametrised} tools 6) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.)
7) Layer, layout (e.g. for comics, zines, etc.) & {re,un}do canvas traits 7) Hotkey & graphical interfaces to {composed,parametrised} tools
8) {Insert,{ex,im}port}ing from/to ANSI, Blender, GIF, HTML, mIRC, printer, SAUCE, WEBM, etc. {clipboard,file} 8) Layer, layout (e.g. for comics, zines, etc.) & {re,un}do canvas traits
9) GUI: a) rightmost alignment of Help menu b) scrollbar c) switch from wxPython to GTK d) toolbar tooltips 9) {Insert,{ex,im}port}ing from/to ANSI, Blender, GIF, HTML, mIRC, printer, SAUCE, WEBM, etc. {clipboard,file}
10) Asset management (e.g. kade, lion, etc.) & traits w/ simple linking & synchronised editing respecting layers 10) Asset management (e.g. kade, lion, etc.) & traits w/ simple linking & synchronised editing respecting layers
11) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...) 11) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...)
12) Composition and parametrisation of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools; unit tools: 12) Composition and parametrisation of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools; unit tools:

View File

@ -7,20 +7,20 @@
import os, sys, wx import os, sys, wx
# #
# Types # Types (0xe000-0xefff)
TID_ACCELS = (0x001) TID_ACCELS = (0xe000)
TID_COMMAND = (0x002) TID_COMMAND = (0xe001)
TID_LIST = (0x003) TID_LIST = (0xe002)
TID_MENU = (0x004) TID_MENU = (0xe003)
TID_NOTHING = (0x005) TID_NOTHING = (0xe004)
TID_SELECT = (0x006) TID_SELECT = (0xe005)
TID_TOOLBAR = (0x007) TID_TOOLBAR = (0xe006)
# #
# Non-items # Non-items (0xf000-0xffff)
NID_MENU_SEP = (0x200, TID_NOTHING) NID_MENU_SEP = (0xf000, TID_NOTHING)
NID_TOOLBAR_HSEP = (0x201, TID_NOTHING) NID_TOOLBAR_HSEP = (0xf001, TID_NOTHING)
NID_TOOLBAR_VSEP = (0x202, TID_NOTHING) NID_TOOLBAR_VSEP = (0xf002, TID_NOTHING)
class GuiGeneralFrame(wx.Frame): class GuiGeneralFrame(wx.Frame):
"""XXX""" """XXX"""
@ -74,9 +74,7 @@ class GuiGeneralFrame(wx.Frame):
self.toolBars = [None]; numToolBar = 0; self.toolBars = [None]; numToolBar = 0;
for toolBarItem in toolBarsDescr[2]: for toolBarItem in toolBarsDescr[2]:
if self.toolBars[numToolBar] == None: if self.toolBars[numToolBar] == None:
self.toolBars[numToolBar] = \ self.toolBars[numToolBar] = wx.ToolBar(panelSkin, -1, style=wx.TB_FLAT | wx.HORIZONTAL | wx.TB_NODIVIDER)
wx.ToolBar(panelSkin, -1, \
style=wx.HORIZONTAL|wx.TB_FLAT|wx.TB_NODIVIDER)
self.toolBars[numToolBar].SetToolBitmapSize((16,16)) self.toolBars[numToolBar].SetToolBitmapSize((16,16))
if toolBarItem == NID_TOOLBAR_HSEP: if toolBarItem == NID_TOOLBAR_HSEP:
self.toolBars[numToolBar].AddSeparator() self.toolBars[numToolBar].AddSeparator()
@ -84,9 +82,7 @@ class GuiGeneralFrame(wx.Frame):
numToolBar += 1; self.toolBars.append(None); numToolBar += 1; self.toolBars.append(None);
elif toolBarItem[1] == TID_SELECT: elif toolBarItem[1] == TID_SELECT:
self.itemsById[toolBarItem[0]] = toolBarItem self.itemsById[toolBarItem[0]] = toolBarItem
toolBarItemWindow = \ toolBarItemWindow = self.toolBars[numToolBar].AddRadioTool(toolBarItem[0], toolBarItem[2], toolBarItem[4][2], shortHelp=toolBarItem[2])
self.toolBars[numToolBar].AddRadioTool( \
toolBarItem[0], toolBarItem[2], toolBarItem[4][2])
self.toolBarItemsById[toolBarItem[0]] = toolBarItemWindow self.toolBarItemsById[toolBarItem[0]] = toolBarItemWindow
if toolBarItem[6] != None: if toolBarItem[6] != None:
toolBarItemWindow.Toggle(toolBarItem[6]) toolBarItemWindow.Toggle(toolBarItem[6])
@ -94,17 +90,14 @@ class GuiGeneralFrame(wx.Frame):
self.Bind(wx.EVT_TOOL_RCLICKED, self.onInput, toolBarItemWindow) self.Bind(wx.EVT_TOOL_RCLICKED, self.onInput, toolBarItemWindow)
else: else:
self.itemsById[toolBarItem[0]] = toolBarItem self.itemsById[toolBarItem[0]] = toolBarItem
toolBarItemWindow = \ toolBarItemWindow = self.toolBars[numToolBar].AddTool(toolBarItem[0], toolBarItem[2], toolBarItem[4][2], toolBarItem[2])
self.toolBars[numToolBar].AddTool( \
toolBarItem[0], toolBarItem[2], toolBarItem[4][2])
self.toolBarItemsById[toolBarItem[0]] = toolBarItemWindow self.toolBarItemsById[toolBarItem[0]] = toolBarItemWindow
if toolBarItem[6] != None: if toolBarItem[6] != None:
toolBarItemWindow.Enable(toolBarItem[6]) toolBarItemWindow.Enable(toolBarItem[6])
self.Bind(wx.EVT_TOOL, self.onInput, toolBarItemWindow) self.Bind(wx.EVT_TOOL, self.onInput, toolBarItemWindow)
self.Bind(wx.EVT_TOOL_RCLICKED, self.onInput, toolBarItemWindow) self.Bind(wx.EVT_TOOL_RCLICKED, self.onInput, toolBarItemWindow)
for numToolBar in range(len(self.toolBars)): for numToolBar in range(len(self.toolBars)):
self.sizerSkin.Add( \ self.sizerSkin.Add(self.toolBars[numToolBar], 0, wx.ALL|wx.ALIGN_LEFT, 3)
self.toolBars[numToolBar], 0, wx.ALL|wx.ALIGN_LEFT, 3)
self.toolBars[numToolBar].Realize() self.toolBars[numToolBar].Realize()
self.toolBars[numToolBar].Fit() self.toolBars[numToolBar].Fit()
# }}} # }}}
@ -115,19 +108,16 @@ class GuiGeneralFrame(wx.Frame):
or toolBarItem == NID_TOOLBAR_VSEP: or toolBarItem == NID_TOOLBAR_VSEP:
continue continue
elif toolBarItem[4] == None: elif toolBarItem[4] == None:
toolBarItem[4] = ["", None, wx.ArtProvider.GetBitmap( \ toolBarItem[4] = ["", None, wx.ArtProvider.GetBitmap(wx.ART_HELP, wx.ART_TOOLBAR, (16,16))]
wx.ART_HELP, wx.ART_TOOLBAR, (16,16))]
elif toolBarItem[4][0] == "" \ elif toolBarItem[4][0] == "" \
and toolBarItem[4][1] != None: and toolBarItem[4][1] != None:
toolBarItem[4] = ["", None, wx.ArtProvider.GetBitmap( \ toolBarItem[4] = ["", None, wx.ArtProvider.GetBitmap(toolBarItem[4][1], wx.ART_TOOLBAR, (16,16))]
toolBarItem[4][1], wx.ART_TOOLBAR, (16,16))]
elif toolBarItem[4][0] == "" \ elif toolBarItem[4][0] == "" \
and toolBarItem[4][1] == None: and toolBarItem[4][1] == None:
toolBarItem[4] = ["", None, toolBarItem[4][2]] toolBarItem[4] = ["", None, toolBarItem[4][2]]
elif toolBarItem[4][0] != "": elif toolBarItem[4][0] != "":
toolBitmapPathName = os.path.dirname(sys.argv[0]) toolBitmapPathName = os.path.dirname(sys.argv[0])
toolBitmapPathName = os.path.join(toolBitmapPathName, \ toolBitmapPathName = os.path.join(toolBitmapPathName, "assets", "images", toolBarItem[4][0])
"assets", "images", toolBarItem[4][0])
toolBitmap = wx.Bitmap((16,16)) toolBitmap = wx.Bitmap((16,16))
toolBitmap.LoadFile(toolBitmapPathName, wx.BITMAP_TYPE_ANY) toolBitmap.LoadFile(toolBitmapPathName, wx.BITMAP_TYPE_ANY)
toolBarItem[4] = ["", None, toolBitmap] toolBarItem[4] = ["", None, toolBitmap]
@ -144,8 +134,7 @@ class GuiGeneralFrame(wx.Frame):
panelSkin = wx.Panel(self, wx.ID_ANY) panelSkin = wx.Panel(self, wx.ID_ANY)
# Initialise accelerators (hotkeys) # Initialise accelerators (hotkeys)
accelTable = wx.AcceleratorTable( \ accelTable = wx.AcceleratorTable(self._initAccelTable(self.LID_ACCELS[2]))
self._initAccelTable(self.LID_ACCELS[2]))
self.SetAcceleratorTable(accelTable) self.SetAcceleratorTable(accelTable)
# Initialise menu bar, menus & menu items # Initialise menu bar, menus & menu items