mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 23:36:36 +00:00
MiRCART{CanvasInterface,{,General}Frame}.py: add & sync {tools,colour selection} toolbar items as radio tools.
This commit is contained in:
parent
fe5e453187
commit
e336730d80
@ -296,42 +296,56 @@ class MiRCARTCanvasInterface():
|
|||||||
def canvasToolCircle(self, event):
|
def canvasToolCircle(self, event):
|
||||||
self.canvasTool = MiRCARTToolCircle(self.parentCanvas)
|
self.canvasTool = MiRCARTToolCircle(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_CIRCLE[0]].Check(True)
|
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)
|
self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolFill(self, event): XXX
|
# {{{ canvasToolFill(self, event): XXX
|
||||||
def canvasToolFill(self, event):
|
def canvasToolFill(self, event):
|
||||||
self.canvasTool = MiRCARTToolFill(self.parentCanvas)
|
self.canvasTool = MiRCARTToolFill(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_FILL[0]].Check(True)
|
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)
|
self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolLine(self, event): XXX
|
# {{{ canvasToolLine(self, event): XXX
|
||||||
def canvasToolLine(self, event):
|
def canvasToolLine(self, event):
|
||||||
self.canvasTool = MiRCARTToolLine(self.parentCanvas)
|
self.canvasTool = MiRCARTToolLine(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_LINE[0]].Check(True)
|
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)
|
self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolSelectClone(self, event): XXX
|
# {{{ canvasToolSelectClone(self, event): XXX
|
||||||
def canvasToolSelectClone(self, event):
|
def canvasToolSelectClone(self, event):
|
||||||
self.canvasTool = MiRCARTToolSelectClone(self.parentCanvas)
|
self.canvasTool = MiRCARTToolSelectClone(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_CLONE_SELECT[0]].Check(True)
|
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)
|
self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolSelectMove(self, event): XXX
|
# {{{ canvasToolSelectMove(self, event): XXX
|
||||||
def canvasToolSelectMove(self, event):
|
def canvasToolSelectMove(self, event):
|
||||||
self.canvasTool = MiRCARTToolSelectMove(self.parentCanvas)
|
self.canvasTool = MiRCARTToolSelectMove(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_MOVE_SELECT[0]].Check(True)
|
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)
|
self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolRect(self, event): XXX
|
# {{{ canvasToolRect(self, event): XXX
|
||||||
def canvasToolRect(self, event):
|
def canvasToolRect(self, event):
|
||||||
self.canvasTool = MiRCARTToolRect(self.parentCanvas)
|
self.canvasTool = MiRCARTToolRect(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_RECT[0]].Check(True)
|
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)
|
self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolText(self, event): XXX
|
# {{{ canvasToolText(self, event): XXX
|
||||||
def canvasToolText(self, event):
|
def canvasToolText(self, event):
|
||||||
self.canvasTool = MiRCARTToolText(self.parentCanvas)
|
self.canvasTool = MiRCARTToolText(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_TEXT[0]].Check(True)
|
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)
|
self.parentFrame.onCanvasUpdate(toolName=self.canvasTool.name)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasUndo(self, event): XXX
|
# {{{ canvasUndo(self, event): XXX
|
||||||
|
@ -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_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_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_COLOUR00 = [0x1a0, TID_SELECT, "Colour #00", "Colour #00", None, None, True, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR01 = [0x1a1, TID_COMMAND, "Colour #01", "Colour #01", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR01 = [0x1a1, TID_SELECT, "Colour #01", "Colour #01", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR02 = [0x1a2, TID_COMMAND, "Colour #02", "Colour #02", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR02 = [0x1a2, TID_SELECT, "Colour #02", "Colour #02", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR03 = [0x1a3, TID_COMMAND, "Colour #03", "Colour #03", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR03 = [0x1a3, TID_SELECT, "Colour #03", "Colour #03", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR04 = [0x1a4, TID_COMMAND, "Colour #04", "Colour #04", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR04 = [0x1a4, TID_SELECT, "Colour #04", "Colour #04", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR05 = [0x1a5, TID_COMMAND, "Colour #05", "Colour #05", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR05 = [0x1a5, TID_SELECT, "Colour #05", "Colour #05", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR06 = [0x1a6, TID_COMMAND, "Colour #06", "Colour #06", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR06 = [0x1a6, TID_SELECT, "Colour #06", "Colour #06", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR07 = [0x1a7, TID_COMMAND, "Colour #07", "Colour #07", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR07 = [0x1a7, TID_SELECT, "Colour #07", "Colour #07", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR08 = [0x1a8, TID_COMMAND, "Colour #08", "Colour #08", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR08 = [0x1a8, TID_SELECT, "Colour #08", "Colour #08", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR09 = [0x1a9, TID_COMMAND, "Colour #09", "Colour #09", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR09 = [0x1a9, TID_SELECT, "Colour #09", "Colour #09", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR10 = [0x1aa, TID_COMMAND, "Colour #10", "Colour #10", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR10 = [0x1aa, TID_SELECT, "Colour #10", "Colour #10", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR11 = [0x1ab, TID_COMMAND, "Colour #11", "Colour #11", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR11 = [0x1ab, TID_SELECT, "Colour #11", "Colour #11", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR12 = [0x1ac, TID_COMMAND, "Colour #12", "Colour #12", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR12 = [0x1ac, TID_SELECT, "Colour #12", "Colour #12", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR13 = [0x1ad, TID_COMMAND, "Colour #13", "Colour #13", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR13 = [0x1ad, TID_SELECT, "Colour #13", "Colour #13", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR14 = [0x1ae, TID_COMMAND, "Colour #14", "Colour #14", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR14 = [0x1ae, TID_SELECT, "Colour #14", "Colour #14", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
CID_COLOUR15 = [0x1af, TID_COMMAND, "Colour #15", "Colour #15", None, None, None, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR15 = [0x1af, TID_SELECT, "Colour #15", "Colour #15", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ Menus
|
# {{{ Menus
|
||||||
MID_FILE = (0x300, TID_MENU, "File", "&File", ( \
|
MID_FILE = (0x300, TID_MENU, "File", "&File", ( \
|
||||||
|
@ -103,15 +103,23 @@ class MiRCARTGeneralFrame(wx.Frame):
|
|||||||
self.toolBars[numToolBar].AddSeparator()
|
self.toolBars[numToolBar].AddSeparator()
|
||||||
elif toolBarItem == NID_TOOLBAR_VSEP:
|
elif toolBarItem == NID_TOOLBAR_VSEP:
|
||||||
numToolBar += 1; self.toolBars.append(None);
|
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:
|
else:
|
||||||
self.itemsById[toolBarItem[0]] = toolBarItem
|
self.itemsById[toolBarItem[0]] = toolBarItem
|
||||||
toolBarItemWindow = \
|
toolBarItemWindow = \
|
||||||
self.toolBars[numToolBar].AddTool( \
|
self.toolBars[numToolBar].AddTool( \
|
||||||
toolBarItem[0], toolBarItem[2], \
|
toolBarItem[0], toolBarItem[2], toolBarItem[4][2])
|
||||||
toolBarItem[4][2])
|
|
||||||
self.toolBarItemsById[toolBarItem[0]] = toolBarItemWindow
|
self.toolBarItemsById[toolBarItem[0]] = toolBarItemWindow
|
||||||
if toolBarItem[6] != None \
|
if toolBarItem[6] != None:
|
||||||
and toolBarItem[1] == TID_COMMAND:
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user