Ejemplo n.º 1
0
    def BuildLayoutActions(self):
        """Add tools, set long help strings and bind toolbar events."""
        actns = [
            ActionItem('Editor',
                       os.path.join('data', 'images',
                                    'application-sidebar-list.png'),
                       self.OnLayout,
                       ID_LAYOUT_EDITOR,
                       kind=wx.ITEM_RADIO),
            ActionItem('Game',
                       os.path.join('data', 'images', 'layout-game.png'),
                       self.OnLayout,
                       ID_LAYOUT_GAME,
                       kind=wx.ITEM_RADIO),
            ActionItem('Both',
                       os.path.join('data', 'images', 'layout-both.png'),
                       self.OnLayout,
                       ID_LAYOUT_BOTH,
                       kind=wx.ITEM_RADIO)
        ]

        # Create layout toolbar
        self.tbLayout = CustomAuiToolBar(self, -1)
        self.tbLayout.SetToolBitmapSize(TBAR_ICON_SIZE)
        self.tbLayout.AddSpacer(
            0
        )  # Need to insert a null object here or the radio buttons don't seem to work (win7 at least).
        self.tbLayout.AppendActionItems(actns)
        self.tbLayout.ToggleTool(ID_LAYOUT_EDITOR, True)
        self.tbLayout.Realize()
Ejemplo n.º 2
0
    def BuildEditActions(self):
        """Add tools, set long help strings and bind toolbar events."""
        commonActns = [
            ActionItem('Undo',
                       os.path.join('data', 'images', 'arrow-curve-flip.png'),
                       self.OnSingleCommand, ID_EDIT_UNDO),
            ActionItem('Redo', os.path.join('data', 'images',
                                            'arrow-curve.png'),
                       self.OnSingleCommand, ID_EDIT_REDO)
        ]

        grpActns = [
            ActionItem('Group', '', self.OnSingleCommand, ID_EDIT_GROUP),
            ActionItem('Ungroup', '', self.OnSingleCommand, ID_EDIT_UNGROUP)
        ]

        pntActns = [
            ActionItem('Parent', '', self.OnSingleCommand, ID_EDIT_PARENT),
            ActionItem('Unparent', '', self.OnSingleCommand, ID_EDIT_UNPARENT)
        ]

        # Create edit menu
        self.mEdit = CustomMenu()
        self.mEdit.AppendActionItems(commonActns, self)
        self.mEdit.AppendSeparator()
        self.mEdit.AppendActionItems(grpActns, self)
        #self.mEdit.AppendSeparator()
        #self.mEdit.AppendActionItems( pntActns, self )

        # Create edit toolbar
        self.tbEdit = CustomAuiToolBar(self, -1)
        self.tbEdit.SetToolBitmapSize(TBAR_ICON_SIZE)
        self.tbEdit.AppendActionItems(commonActns)
        self.tbEdit.Realize()
Ejemplo n.º 3
0
 def BuildFileActions( self ):
     """Add tools, set long help strings and bind toolbar events."""
     commonActns = [
         ActionItem( 'New', os.path.join( 'data', 'images', 'document.png' ), self.OnFileNew, ID_FILE_NEW ),
         ActionItem( 'Open', os.path.join( 'data', 'images', 'folder-horizontal-open.png' ), self.OnFileOpen, ID_FILE_OPEN ),
         ActionItem( 'Save', os.path.join( 'data', 'images', 'disk-black.png' ), self.OnFileSave, ID_FILE_SAVE ),
         ActionItem( 'Save As', os.path.join( 'data', 'images', 'disk-black-pencil.png' ), self.OnFileSaveAs, ID_FILE_SAVE_AS ),
     ]
     
     # Create file menu
     self.mFile = CustomMenu()
     self.mFile.AppendActionItems( commonActns, self )
     self.mFile.AppendSeparator()
     self.mFile.AppendActionItem( ActionItem( 'Import...', '', self.OnFileImport, ID_FILE_IMPORT ), self )
     
     # Create project actions as a submenu
     self.mProj = CustomMenu()
     actns = [
         ActionItem( 'New...', '', self.OnFileNewProject, ID_PROJ_NEW ),
         ActionItem( 'Set...', '', self.OnFileSetProject, ID_PROJ_SET ),
         ActionItem( 'Build...', '', self.OnFileBuildProject, ID_PROJ_BUILD )
     ]
     self.mProj.AppendActionItems( actns, self )
     self.mFile.AppendMenu( ID_FILE_PROJ, '&Project', self.mProj )
     
     # Create file toolbar
     self.tbFile = CustomAuiToolBar( self, -1, style=wx.aui.AUI_TB_DEFAULT_STYLE )
     self.tbFile.SetToolBitmapSize( TBAR_ICON_SIZE )
     self.tbFile.AppendActionItems( commonActns )
     self.tbFile.Realize()
Ejemplo n.º 4
0
 def BuildPlaybackToolBar(self):
     """Build playback toolbar."""
     dirPath = os.path.join(os.path.split(__file__)[0], 'images')
     playbackActns = [
         ActionItem('Play', os.path.join(dirPath, 'play.png'), self.OnPlay,
                    ID_PLAY, 'Play'),
         ActionItem('Pause', os.path.join(dirPath, 'pause.png'),
                    self.OnPause, ID_PAUSE, 'Pause')
     ]
     self.tbPlay = CustomAuiToolBar(self.ui,
                                    -1,
                                    style=wx.aui.AUI_TB_DEFAULT_STYLE)
     self.tbPlay.SetToolBitmapSize(TBAR_ICON_SIZE)
     self.tbPlay.AppendActionItems(playbackActns)
Ejemplo n.º 5
0
 def BuildModifyActions( self ):
     """Add tools, set long help strings and bind toolbar events."""
     actns = [
         ActionItem( 'Engage Physics', os.path.join( 'data', 'images', 'point.png' ), self.OnEngagePhysics, ID_MODIFY_PHYSICS, kind=wx.ITEM_CHECK )
     ]
     
     # Create edit menu
     self.mModify = CustomMenu()
     self.mModify.AppendActionItems( actns, self )
     
     # Create edit toolbar
     self.tbModify = CustomAuiToolBar( self, -1, style=wx.aui.AUI_TB_DEFAULT_STYLE )
     self.tbModify.SetToolBitmapSize( TBAR_ICON_SIZE )
     self.tbModify.AppendActionItems( actns )
     self.tbModify.Realize()
Ejemplo n.º 6
0
 def BuildXformActions( self ):
     """Add tools, set long help strings and bind toolbar events."""
     fn = self.OnXformSetActiveGizmo
     actns = [
         ActionItem( 'Select', os.path.join( 'data', 'images', 'select.png' ), fn, ID_XFORM_SEL, kind=wx.ITEM_RADIO ),
         ActionItem( 'Move', os.path.join( 'data', 'images', 'move.png' ), fn, ID_XFORM_POS, kind=wx.ITEM_RADIO ),
         ActionItem( 'Rotate', os.path.join( 'data', 'images', 'rotate.png' ), fn, ID_XFORM_ROT, kind=wx.ITEM_RADIO ),
         ActionItem( 'Scale', os.path.join( 'data', 'images', 'scale.png' ), fn, ID_XFORM_SCL, kind=wx.ITEM_RADIO ),
         ActionItem( 'World Transform', os.path.join( 'data', 'images', 'globe.png' ), fn, ID_XFORM_WORLD, kind=wx.ITEM_CHECK )
     ]
     
     # Create xform toolbar
     self.tbXform = CustomAuiToolBar( self, -1, style=wx.aui.AUI_TB_DEFAULT_STYLE )
     self.tbXform.SetToolBitmapSize( TBAR_ICON_SIZE )
     self.tbXform.AddSpacer( 0 )   # Need to insert a null object here or the radio buttons don't seem to work (win7 at least).
     self.tbXform.AppendActionItems( actns )
     self.tbXform.Realize()