Пример #1
0
    def __init__(self, parent, id):
        wx.TreeCtrl.__init__(self, parent, id, style = wx.TR_HAS_BUTTONS | wx.TR_MULTIPLE)
        self.SetBackgroundColour(wx.Colour(224, 248, 224))
        # Register events
        wx.EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged)
        # One works on Linux, another on Windows
        if wx.Platform == '__WXGTK__':
            wx.EVT_TREE_ITEM_ACTIVATED(self, self.GetId(), self.OnItemActivated)
        else:
            wx.EVT_LEFT_DCLICK(self, self.OnDClick)
        wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
        wx.EVT_TREE_ITEM_EXPANDED(self, self.GetId(), self.OnItemExpandedCollapsed)
        wx.EVT_TREE_ITEM_COLLAPSED(self, self.GetId(), self.OnItemExpandedCollapsed)

        self.selection = None
        self.selectionChanging = False
        self.needUpdate = False
        self.pendingHighLight = None
        self.ctrl = self.shift = False
        self.dom = None
        # Create image list
        il = wx.ImageList(16, 16, True)
        self.rootImage = il.Add(images.getTreeRootImage().Scale(16,16).ConvertToBitmap())
        xxxObject.image = il.Add(images.getTreeDefaultImage().Scale(16,16).ConvertToBitmap())
        xxxPanel.image = il.Add(images.getTreePanelImage().Scale(16,16).ConvertToBitmap())
        xxxDialog.image = il.Add(images.getTreeDialogImage().Scale(16,16).ConvertToBitmap())
        xxxFrame.image = il.Add(images.getTreeFrameImage().Scale(16,16).ConvertToBitmap())
        xxxMenuBar.image = il.Add(images.getTreeMenuBarImage().Scale(16,16).ConvertToBitmap())
        xxxMenu.image = il.Add(images.getTreeMenuImage().Scale(16,16).ConvertToBitmap())
        xxxMenuItem.image = il.Add(images.getTreeMenuItemImage().Scale(16,16).ConvertToBitmap())
        xxxToolBar.image = il.Add(images.getTreeToolBarImage().Scale(16,16).ConvertToBitmap())
        xxxTool.image = il.Add(images.getTreeToolImage().Scale(16,16).ConvertToBitmap())
        xxxSeparator.image = il.Add(images.getTreeSeparatorImage().Scale(16,16).ConvertToBitmap())
        xxxSizer.imageH = il.Add(images.getTreeSizerHImage().Scale(16,16).ConvertToBitmap())
        xxxSizer.imageV = il.Add(images.getTreeSizerVImage().Scale(16,16).ConvertToBitmap())
        xxxStaticBoxSizer.imageH = il.Add(images.getTreeStaticBoxSizerHImage().Scale(16,16).ConvertToBitmap())
        xxxStaticBoxSizer.imageV = il.Add(images.getTreeStaticBoxSizerVImage().Scale(16,16).ConvertToBitmap())
        xxxGridSizer.image = il.Add(images.getTreeSizerGridImage().Scale(16,16).ConvertToBitmap())
        xxxFlexGridSizer.image = il.Add(images.getTreeSizerFlexGridImage().Scale(16,16).ConvertToBitmap())
        self.il = il
        self.SetImageList(il)
Пример #2
0
c = SmartContainer(
    'wxPropertySheetDialog', ['frame', 'book', 'window', 'top_level'],
    ['pos', 'size', 'title', 'centered', 'icon', 'sheetstyle', 'buttons'],
    params={
        'buttons': ParamButtons,
        'sheetstyle': ParamSheetStyle
    },
    implicit_klass='propertysheetpage',
    implicit_page='PropertySheetPage',
    implicit_attributes=['label', 'selected', 'bitmap'],
    implicit_params={
        'label': params.ParamText,
        'selected': params.ParamBool
    },
    image=images.getTreeDialogImage())
c.isTopLevel = True
c.setSpecial('bitmap', BitmapAttribute)
c.setSpecial('icon', BitmapAttribute)
c.addStyles('wxDEFAULT_DIALOG_STYLE', 'wxCAPTION', 'wxFRAME_SHAPED',
            'wxTAB_TRAVERSAL', 'wxSTAY_ON_TOP', 'wxSYSTEM_MENU',
            'wxRESIZE_BORDER', 'wxCLOSE_BOX', 'wxMAXIMIZE_BOX',
            'wxMINIMIZE_BOX', 'wxDIALOG_MODAL', 'wxDIALOG_MODELESS',
            'wxDIALOG_NO_PARENT', 'wxNO_3D', 'wxTAB_TRAVERSAL')
c.addExStyles('wxDIALOG_EX_CONTEXTHELP', 'wxWS_EX_VALIDATE_RECURSIVELY',
              'wxDIALOG_EX_METAL')
c.addEvents('EVT_INIT_DIALOG', 'EVT_SIZE', 'EVT_CLOSE', 'EVT_ICONIZE',
            'EVT_MAXIMIZE', 'EVT_ACTIVATE', 'EVT_UPDATE_UI')
Manager.register(c)
Manager.setMenu(c, 'TOP_LEVEL', 'propery sheet dialog',
                'wxPropertySheetDialog', 50)
Пример #3
0
    values = ['wxOK', 'wxCANCEL', 'wxYES', 'wxNO', 'wxHELP', 'wxNO_DEFAULT']
class ParamSheetStyle(params.ParamBinaryOr):
    '''Button flags.'''
    values = ['wxPROPSHEET_DEFAULT', 'wxPROPSHEET_NOTEBOOK',
            'wxPROPSHEET_CHOICEBOOK', 'wxPROPSHEET_LISTBOOK', 
# Tool book needs an image list
#            'wxPROPSHEET_TOOLBOOK', 'wxPROPSHEET_BUTTONTOOLBOOK',
            'wxPROPSHEET_TREEBOOK', 'wxPROPSHEET_SHRINKTOFIT']
c = SmartContainer('wxPropertySheetDialog', ['frame','book','window','top_level'], 
                   ['pos', 'size', 'title', 'centered', 'icon', 'sheetstyle', 'buttons'],
                   params={'buttons': ParamButtons, 'sheetstyle': ParamSheetStyle},
                   implicit_klass='propertysheetpage', 
                   implicit_page='PropertySheetPage', 
                   implicit_attributes=['label', 'selected', 'bitmap'],
                   implicit_params={'label': params.ParamText, 'selected': params.ParamBool},
                   image=images.getTreeDialogImage())
c.isTopLevel = True
c.setSpecial('bitmap', BitmapAttribute)
c.setSpecial('icon', BitmapAttribute)
c.addStyles('wxDEFAULT_DIALOG_STYLE', 'wxCAPTION', 'wxFRAME_SHAPED',
            'wxTAB_TRAVERSAL', 'wxSTAY_ON_TOP', 'wxSYSTEM_MENU', 
            'wxRESIZE_BORDER', 'wxCLOSE_BOX', 'wxMAXIMIZE_BOX', 'wxMINIMIZE_BOX',
            'wxDIALOG_MODAL', 'wxDIALOG_MODELESS', 'wxDIALOG_NO_PARENT',
            'wxNO_3D', 'wxTAB_TRAVERSAL')
c.addExStyles('wxDIALOG_EX_CONTEXTHELP', 'wxWS_EX_VALIDATE_RECURSIVELY', 'wxDIALOG_EX_METAL')
c.addEvents('EVT_INIT_DIALOG', 'EVT_SIZE', 'EVT_CLOSE', 
            'EVT_ICONIZE', 'EVT_MAXIMIZE', 'EVT_ACTIVATE', 'EVT_UPDATE_UI')
Manager.register(c)
Manager.setMenu(c, 'TOP_LEVEL', 'propery sheet dialog', 'wxPropertySheetDialog', 50)
Manager.setTool(c, 'Windows', bitmaps.getwxPropertySheetDialogBitmap(), (1,1))
Пример #4
0
    def __init__(self, parent, id):
        wxTreeCtrl.__init__(self, parent, id, style=wxTR_HAS_BUTTONS)
        self.SetBackgroundColour(wxColour(224, 248, 224))
        # Register events
        EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged)
        # One works on Linux, another on Windows
        if wxPlatform == '__WXGTK__':
            EVT_TREE_ITEM_ACTIVATED(self, self.GetId(), self.OnItemActivated)
        else:
            EVT_LEFT_DCLICK(self, self.OnDClick)
        EVT_RIGHT_DOWN(self, self.OnRightDown)
        EVT_TREE_ITEM_EXPANDED(self, self.GetId(),
                               self.OnItemExpandedCollapsed)
        EVT_TREE_ITEM_COLLAPSED(self, self.GetId(),
                                self.OnItemExpandedCollapsed)

        self.selection = None
        self.needUpdate = False
        self.pendingHighLight = None
        self.ctrl = self.shift = False
        self.dom = None
        # Create image list
        il = wxImageList(16, 16, True)
        self.rootImage = il.Add(images.getTreeRootImage().Scale(
            16, 16).ConvertToBitmap())
        xxxObject.image = il.Add(images.getTreeDefaultImage().Scale(
            16, 16).ConvertToBitmap())
        xxxPanel.image = il.Add(images.getTreePanelImage().Scale(
            16, 16).ConvertToBitmap())
        xxxDialog.image = il.Add(images.getTreeDialogImage().Scale(
            16, 16).ConvertToBitmap())
        xxxFrame.image = il.Add(images.getTreeFrameImage().Scale(
            16, 16).ConvertToBitmap())
        xxxMenuBar.image = il.Add(images.getTreeMenuBarImage().Scale(
            16, 16).ConvertToBitmap())
        xxxMenu.image = il.Add(images.getTreeMenuImage().Scale(
            16, 16).ConvertToBitmap())
        xxxMenuItem.image = il.Add(images.getTreeMenuItemImage().Scale(
            16, 16).ConvertToBitmap())
        xxxToolBar.image = il.Add(images.getTreeToolBarImage().Scale(
            16, 16).ConvertToBitmap())
        xxxTool.image = il.Add(images.getTreeToolImage().Scale(
            16, 16).ConvertToBitmap())
        xxxSeparator.image = il.Add(images.getTreeSeparatorImage().Scale(
            16, 16).ConvertToBitmap())
        xxxSizer.imageH = il.Add(images.getTreeSizerHImage().Scale(
            16, 16).ConvertToBitmap())
        xxxSizer.imageV = il.Add(images.getTreeSizerVImage().Scale(
            16, 16).ConvertToBitmap())
        xxxStaticBoxSizer.imageH = il.Add(
            images.getTreeStaticBoxSizerHImage().Scale(16,
                                                       16).ConvertToBitmap())
        xxxStaticBoxSizer.imageV = il.Add(
            images.getTreeStaticBoxSizerVImage().Scale(16,
                                                       16).ConvertToBitmap())
        xxxGridSizer.image = il.Add(images.getTreeSizerGridImage().Scale(
            16, 16).ConvertToBitmap())
        xxxFlexGridSizer.image = il.Add(
            images.getTreeSizerFlexGridImage().Scale(16, 16).ConvertToBitmap())
        self.il = il
        self.SetImageList(il)