diff --git a/MiRCARTCanvasInterface.py b/MiRCARTCanvasInterface.py index 0078da9..011d45f 100644 --- a/MiRCARTCanvasInterface.py +++ b/MiRCARTCanvasInterface.py @@ -296,42 +296,56 @@ class MiRCARTCanvasInterface(): def canvasToolCircle(self, event): self.canvasTool = MiRCARTToolCircle(self.parentCanvas) self.parentFrame.menuItemsById[self.parentFrame.CID_CIRCLE[0]].Check(True) + toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_CIRCLE[0]].GetToolBar() + toolBar.ToggleTool(self.parentFrame.CID_CIRCLE[0], True) self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name) # }}} # {{{ canvasToolFill(self, event): XXX def canvasToolFill(self, event): self.canvasTool = MiRCARTToolFill(self.parentCanvas) self.parentFrame.menuItemsById[self.parentFrame.CID_FILL[0]].Check(True) + toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_FILL[0]].GetToolBar() + toolBar.ToggleTool(self.parentFrame.CID_FILL[0], True) self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name) # }}} # {{{ canvasToolLine(self, event): XXX def canvasToolLine(self, event): self.canvasTool = MiRCARTToolLine(self.parentCanvas) self.parentFrame.menuItemsById[self.parentFrame.CID_LINE[0]].Check(True) + toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_LINE[0]].GetToolBar() + toolBar.ToggleTool(self.parentFrame.CID_LINE[0], True) self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name) # }}} # {{{ canvasToolSelectClone(self, event): XXX def canvasToolSelectClone(self, event): self.canvasTool = MiRCARTToolSelectClone(self.parentCanvas) self.parentFrame.menuItemsById[self.parentFrame.CID_CLONE_SELECT[0]].Check(True) + toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_CLONE_SELECT[0]].GetToolBar() + toolBar.ToggleTool(self.parentFrame.CID_CLONE_SELECT[0], True) self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name) # }}} # {{{ canvasToolSelectMove(self, event): XXX def canvasToolSelectMove(self, event): self.canvasTool = MiRCARTToolSelectMove(self.parentCanvas) self.parentFrame.menuItemsById[self.parentFrame.CID_MOVE_SELECT[0]].Check(True) + toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_MOVE_SELECT[0]].GetToolBar() + toolBar.ToggleTool(self.parentFrame.CID_MOVE_SELECT[0], True) self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name) # }}} # {{{ canvasToolRect(self, event): XXX def canvasToolRect(self, event): self.canvasTool = MiRCARTToolRect(self.parentCanvas) self.parentFrame.menuItemsById[self.parentFrame.CID_RECT[0]].Check(True) + toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_RECT[0]].GetToolBar() + toolBar.ToggleTool(self.parentFrame.CID_RECT[0], True) self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name) # }}} # {{{ canvasToolText(self, event): XXX def canvasToolText(self, event): self.canvasTool = MiRCARTToolText(self.parentCanvas) self.parentFrame.menuItemsById[self.parentFrame.CID_TEXT[0]].Check(True) + toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_TEXT[0]].GetToolBar() + toolBar.ToggleTool(self.parentFrame.CID_TEXT[0], True) self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name) # }}} # {{{ canvasUndo(self, event): XXX diff --git a/MiRCARTFrame.py b/MiRCARTFrame.py index e357e48..6c199aa 100644 --- a/MiRCARTFrame.py +++ b/MiRCARTFrame.py @@ -76,22 +76,22 @@ class MiRCARTFrame(MiRCARTGeneralFrame): CID_CLONE_SELECT = [0x155, TID_SELECT, "Clone", "Cl&one", ["toolClone.png"], [wx.ACCEL_CTRL, ord("E")], False, MiRCARTCanvasInterface.canvasToolSelectClone] CID_MOVE_SELECT = [0x156, TID_SELECT, "Move", "&Move", ["toolMove.png"], [wx.ACCEL_CTRL, ord("M")], False, MiRCARTCanvasInterface.canvasToolSelectMove] - CID_COLOUR00 = [0x1a0, TID_COMMAND, "Colour #00", "Colour #00", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR01 = [0x1a1, TID_COMMAND, "Colour #01", "Colour #01", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR02 = [0x1a2, TID_COMMAND, "Colour #02", "Colour #02", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR03 = [0x1a3, TID_COMMAND, "Colour #03", "Colour #03", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR04 = [0x1a4, TID_COMMAND, "Colour #04", "Colour #04", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR05 = [0x1a5, TID_COMMAND, "Colour #05", "Colour #05", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR06 = [0x1a6, TID_COMMAND, "Colour #06", "Colour #06", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR07 = [0x1a7, TID_COMMAND, "Colour #07", "Colour #07", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR08 = [0x1a8, TID_COMMAND, "Colour #08", "Colour #08", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR09 = [0x1a9, TID_COMMAND, "Colour #09", "Colour #09", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR10 = [0x1aa, TID_COMMAND, "Colour #10", "Colour #10", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR11 = [0x1ab, TID_COMMAND, "Colour #11", "Colour #11", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR12 = [0x1ac, TID_COMMAND, "Colour #12", "Colour #12", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR13 = [0x1ad, TID_COMMAND, "Colour #13", "Colour #13", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR14 = [0x1ae, TID_COMMAND, "Colour #14", "Colour #14", None, None, None, MiRCARTCanvasInterface.canvasColour] - CID_COLOUR15 = [0x1af, TID_COMMAND, "Colour #15", "Colour #15", None, None, None, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR00 = [0x1a0, TID_SELECT, "Colour #00", "Colour #00", None, None, True, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR01 = [0x1a1, TID_SELECT, "Colour #01", "Colour #01", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR02 = [0x1a2, TID_SELECT, "Colour #02", "Colour #02", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR03 = [0x1a3, TID_SELECT, "Colour #03", "Colour #03", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR04 = [0x1a4, TID_SELECT, "Colour #04", "Colour #04", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR05 = [0x1a5, TID_SELECT, "Colour #05", "Colour #05", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR06 = [0x1a6, TID_SELECT, "Colour #06", "Colour #06", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR07 = [0x1a7, TID_SELECT, "Colour #07", "Colour #07", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR08 = [0x1a8, TID_SELECT, "Colour #08", "Colour #08", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR09 = [0x1a9, TID_SELECT, "Colour #09", "Colour #09", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR10 = [0x1aa, TID_SELECT, "Colour #10", "Colour #10", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR11 = [0x1ab, TID_SELECT, "Colour #11", "Colour #11", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR12 = [0x1ac, TID_SELECT, "Colour #12", "Colour #12", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR13 = [0x1ad, TID_SELECT, "Colour #13", "Colour #13", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR14 = [0x1ae, TID_SELECT, "Colour #14", "Colour #14", None, None, False, MiRCARTCanvasInterface.canvasColour] + CID_COLOUR15 = [0x1af, TID_SELECT, "Colour #15", "Colour #15", None, None, False, MiRCARTCanvasInterface.canvasColour] # }}} # {{{ Menus MID_FILE = (0x300, TID_MENU, "File", "&File", ( \ diff --git a/MiRCARTGeneralFrame.py b/MiRCARTGeneralFrame.py index d294b12..ea53385 100644 --- a/MiRCARTGeneralFrame.py +++ b/MiRCARTGeneralFrame.py @@ -103,20 +103,28 @@ class MiRCARTGeneralFrame(wx.Frame): self.toolBars[numToolBar].AddSeparator() elif toolBarItem == NID_TOOLBAR_VSEP: numToolBar += 1; self.toolBars.append(None); + elif toolBarItem[1] == TID_SELECT: + self.itemsById[toolBarItem[0]] = toolBarItem + toolBarItemWindow = \ + self.toolBars[numToolBar].AddRadioTool( \ + toolBarItem[0], toolBarItem[2], toolBarItem[4][2]) + self.toolBarItemsById[toolBarItem[0]] = toolBarItemWindow + if toolBarItem[6] != None: + toolBarItemWindow.Toggle(toolBarItem[6]) + self.Bind(wx.EVT_TOOL, self.onInput, toolBarItemWindow) + self.Bind(wx.EVT_TOOL_RCLICKED, self.onInput, toolBarItemWindow) else: self.itemsById[toolBarItem[0]] = toolBarItem toolBarItemWindow = \ self.toolBars[numToolBar].AddTool( \ - toolBarItem[0], toolBarItem[2], \ - toolBarItem[4][2]) + toolBarItem[0], toolBarItem[2], toolBarItem[4][2]) self.toolBarItemsById[toolBarItem[0]] = toolBarItemWindow - if toolBarItem[6] != None \ - and toolBarItem[1] == TID_COMMAND: + if toolBarItem[6] != None: toolBarItemWindow.Enable(toolBarItem[6]) self.Bind(wx.EVT_TOOL, self.onInput, toolBarItemWindow) self.Bind(wx.EVT_TOOL_RCLICKED, self.onInput, toolBarItemWindow) 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].Realize() self.toolBars[numToolBar].Fit()