Example #1
0
    def setupArtProvider(self, iconDictionary):

        # create Art Provider
        self.art = wx.ArtProvider()

        # push custom art provider with given icons
        wx.ArtProvider.Push(customart.CustomArtProvider(iconDictionary))
    def __init__(self, parent, title=''):
        wx.Menu.__init__(self, title)
        self.parent = parent
        self.ap = wx.ArtProvider()

        self.menuData = [(u'Add Node\tAlt-A', self.ap.GetBitmap(wx.ART_NEW), self.OnAddNode),
            None,
            (u'Rename\tF2', self.ap.GetBitmap(wx.ART_HELP_SETTINGS), self.OnRename),
            (u'Cut\tCtrl-X', self.ap.GetBitmap(wx.ART_CUT), self.OnCut),
            (u'Copy\tCtrl-C', self.ap.GetBitmap(wx.ART_COPY), self.OnCopy),
            (u'Paste\tCtrl-V', self.ap.GetBitmap(wx.ART_PASTE), self.OnPaste),
            (u'Delete\tDel', self.ap.GetBitmap(wx.ART_DELETE), self.OnDeleteNode),
            None,
            (u'Run Editor...', self.ap.GetBitmap(wx.ART_FIND), self.OnRunEditor),
            (u'New SceneView...', self.ap.GetBitmap(wx.ART_NEW), self.OnNewSceneView),
            None,
            (u'&Save ...', self.ap.GetBitmap(wx.ART_FILE_SAVE), self.OnSave),
            (u'&Load ...', self.ap.GetBitmap(wx.ART_FILE_OPEN), self.OnLoad)]

        for md in self.menuData:
            if md == None:
                self.AppendSeparator()
            else:
                mi = wx.MenuItem(self, wx.NewId(), md[0])
                mi.SetBitmap(md[1])
                self.AppendItem(mi)
                self.Bind(wx.EVT_MENU, md[2], id=mi.GetId())
        
        self.runEditorMenuItem = self.FindItemByPosition(8)
        self.newSceneViewMenuItem = self.FindItemByPosition(9)
Example #3
0
def GetStockBitmap(art_id, art_client=None):
    """
	Get a stock bitmap from its wx.ART_xxx ID
	"""
    global _art_provider
    if _art_provider is None:
        _art_provider = wx.ArtProvider()
    return _art_provider.GetBitmap(id=art_id,
                                   client=art_client or wx.ART_OTHER)
Example #4
0
    def testGetBitmap(self):
        """Test getting a bitmap from the provider"""
        ap = wx.ArtProvider()
        bmp = ap.GetBitmap(str(ed_glob.ID_COPY), wx.ART_MENU)
        self.assertTrue(bmp.IsOk())

        bmp = ap.GetBitmap(str(ed_glob.ID_COPY), wx.ART_TOOLBAR)
        self.assertTrue(bmp.IsOk())

        bmp = ap.GetBitmap(str(-1), wx.ART_MENU)
        self.assertTrue(bmp.IsNull())
Example #5
0
    def InitUI(self, config=None):
        artprovider = wx.ArtProvider()
        toolbar = self.CreateToolBar(style=wx.TB_TEXT | wx.TB_HORZ_LAYOUT)
        toolOpen = toolbar.AddTool(
            wx.ID_ANY, 'Open',
            artprovider.GetBitmap(wx.ART_FILE_OPEN, client=wx.ART_TOOLBAR),
            "Open an i3 config file")
        toolSave = toolbar.AddTool(
            wx.ID_ANY, 'Save',
            artprovider.GetBitmap(wx.ART_FILE_SAVE, client=wx.ART_TOOLBAR),
            "Save the current settings to the open file")
        toolApply = toolbar.AddTool(
            wx.ID_ANY, 'Apply',
            artprovider.GetBitmap(wx.ART_TICK_MARK, client=wx.ART_TOOLBAR),
            "Apply the changes without changing file")
        toolUpdateLocal = toolbar.AddTool(
            wx.ID_ANY, 'Save to config',
            artprovider.GetBitmap(wx.ART_FILE_SAVE_AS, client=wx.ART_TOOLBAR),
            "Save the current colour scheme into your current config")
        toolSnippet = toolbar.AddTool(
            wx.ID_ANY, 'Create colour snippet',
            artprovider.GetBitmap(wx.ART_NEW, client=wx.ART_TOOLBAR),
            "Save the current colour scheme as a standalone colour file you can send to others"
        )
        toolVariable = toolbar.AddTool(
            wx.ID_ANY, 'Create colour variable',
            artprovider.GetBitmap(wx.ART_PLUS, client=wx.ART_TOOLBAR),
            "Create a new colour variable")
        toolbar.AddStretchableSpace()
        toolQuit = toolbar.AddTool(
            wx.ID_ANY, 'Quit',
            artprovider.GetBitmap(wx.ART_QUIT, client=wx.ART_TOOLBAR),
            "Quit the program")

        self.Bind(wx.EVT_TOOL, self.OnQuit, toolQuit)
        self.Bind(wx.EVT_TOOL, self.OnOpen, toolOpen)
        self.Bind(wx.EVT_TOOL, self.OnApply, toolApply)
        self.Bind(wx.EVT_TOOL, self.OnSave, toolSave)
        self.Bind(wx.EVT_TOOL, self.OnUpdateLocal, toolUpdateLocal)
        self.Bind(wx.EVT_TOOL, self.OnCreateSnippet, toolSnippet)
        self.Bind(wx.EVT_TOOL, self.OnCreateVariable, toolVariable)

        self.scrolled = wx.lib.scrolledpanel.ScrolledPanel(self, -1)
        self.scrolled.SetupScrolling()
        self.scrolled.Show()

        self.Centre()
        self.Show(True)

        if config != None:
            self.LoadConfig(config)
Example #6
0
    def __init__(self, parent):

        wx.ToolBar.__init__(self,
                            parent,
                            -1,
                            style=wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT)

        # new instance of wx.ArtProvider
        self.art = wx.ArtProvider()

        # add buttons
        self.refreshButtons()

        # bind buttons to event handlers
        self.connect(parent)
Example #7
0
    def loadImageList(self):

        # create the art provider
        art = wx.ArtProvider()

        # create the image list
        self.imageList = wx.ImageList(16, 16)  ## This seems to be ignored

        # add images to list
        self.imageList.Add(art.GetBitmap(wx.ART_FOLDER))  # index = 0
        self.imageList.Add(art.GetBitmap(wx.ART_FOLDER_OPEN))  # index = 1
        self.imageList.Add(art.GetBitmap(wx.ART_NORMAL_FILE))  # index = 2
        self.imageList.Add(art.GetBitmap(wx.ART_EXECUTABLE_FILE))  # index = 3

        # bind image list to control
        self.AssignImageList(self.imageList)
Example #8
0
    def loadImageList(self):

        # create the art provider
        art = wx.ArtProvider()

        # create the image list
        self.imageList = wx.ImageList(16, 16)  ## This seems to be ignored

        # add images to list ( index starts counting from 0 )
        self.imageList.Add(art.GetBitmap(wx.ART_FOLDER, wx.ART_MENU))
        self.imageList.Add(art.GetBitmap(wx.ART_FLOPPY, wx.ART_MENU))
        self.imageList.Add(art.GetBitmap(wx.ART_CDROM, wx.ART_MENU))
        self.imageList.Add(art.GetBitmap(wx.ART_HARDDISK, wx.ART_MENU))
        self.imageList.Add(art.GetBitmap(wx.ART_REMOVABLE, wx.ART_MENU))

        # bind image list to control
        self.AssignImageList(self.imageList)
Example #9
0
    def __init__(self):
        self.m_dna = dnareflist.DNAList()
        wx.Frame.__init__(self, None, -1, TITLE_HEADER, size=(1024, 768))

        # Art provider.
        self.m_art = wx.ArtProvider()

        self.m_vsplitter = wx.SplitterWindow(self, -1)
        self.m_red = wx.TextCtrl(self.m_vsplitter,
                                 -1,
                                 style=wx.TE_MULTILINE | wx.TE_DONTWRAP)
        self.m_blue = VirtualList(self.m_vsplitter, -1)
        self.m_vsplitter.SplitVertically(self.m_red, self.m_blue, 100)

        menubar = wx.MenuBar()

        file = wx.Menu()

        openitem = file.Append(-1, '&Open DNA\tCtrl+O', 'Open DNA File')

        menubar.Append(file, '&File')
        self.SetMenuBar(menubar)

        self.m_toolBar = self.CreateToolBar(0, -1)
        self.m_toolBar.SetToolSeparation(50)
        stepitem = self.m_toolBar.AddLabelTool(
            -1,
            '',
            self.m_art.GetBitmap(wx.ART_GO_FORWARD, wx.ART_TOOLBAR),
            shortHelp='Single step',
            longHelp='Single step in RNA commands')
        self.m_toolBar.Realize()

        self.CreateStatusBar()
        self.GetStatusBar().SetFieldsCount(3)
        self.GetStatusBar().SetStatusWidths([64, 150, -1])

        # Bind events
        self.Bind(wx.EVT_MENU, self.OnOpenFile, openitem)
        self.Bind(wx.EVT_TOOL, self.OnStep, stepitem)

        self.Show()
Example #10
0
import wx
import wx.gizmos

# Local imports
from windows.winBase import winReportXRC, ShiftMixIn
from windows.xrc.winDesign import winDesignBase

from tp.client.parser import DesignCalculator
from tp.netlib.objects import Design, Component, Category

NAME = 0
DESC = 1

COL_SIZE=150

wx.ArtProvider()
Art = wx.ArtProvider_GetBitmap
wx.ArtSize = (16, 16)

def comparetoid(a, b):
	if not b is None and a[0] == type(b) and a[1] == b.id:
		return True
	return False

def comparebyid(a, b):
	if not b is None and type(a) == type(b) and a.id == b.id:
		return True
	return False


# Show the universe
Example #11
0
    def __init__(self):

        self.m_r2f = rna2fuun.rna2fuun()
        self.m_rna = []
        self.m_row = 0

        wx.Frame.__init__(self, None, -1, TITLE_HEADER, size=(1024, 768))

        # Art provider.
        self.m_art = wx.ArtProvider()

        self.m_vsplitter = wx.SplitterWindow(self, -1)
        self.m_hsplitter = wx.SplitterWindow(self.m_vsplitter, -1)
        self.m_rightpanel = scrolled.ScrolledPanel(self.m_vsplitter,
                                                   -1,
                                                   size=(140, 300),
                                                   style=wx.TAB_TRAVERSAL
                                                   | wx.SUNKEN_BORDER)
        self.m_rnalist = RNAListCtrl(self.m_hsplitter, self)
        self.m_rnalist.InsertColumn(0, "Row")
        self.m_rnalist.InsertColumn(1, "RNA")
        self.m_rnalist.InsertColumn(2, "Translation")
        self.m_image = wx.StaticBitmap(self.m_rightpanel, -1, size=(600, 600))
        self.m_data = wx.TextCtrl(self.m_hsplitter,
                                  -1,
                                  style=wx.TE_MULTILINE | wx.TE_DONTWRAP)
        self.m_vsplitter.SplitVertically(self.m_hsplitter, self.m_rightpanel,
                                         100)
        self.m_hsplitter.SplitHorizontally(self.m_rnalist, self.m_data)
        self.m_leftSizer = wx.BoxSizer(wx.VERTICAL)
        self.m_leftSizer.Add(self.m_rnalist, 0, wx.EXPAND)
        self.m_leftSizer.Add(self.m_data, 1, wx.EXPAND)
        self.m_hsplitter.SetSizer(self.m_leftSizer)
        self.m_hsplitter.SetAutoLayout(1)
        self.m_rightpanel.SetAutoLayout(1)
        self.m_rightpanel.SetupScrolling()

        menubar = wx.MenuBar()

        file = wx.Menu()

        openitem = file.Append(-1, '&Open RNA\tCtrl+O', 'Open RNA File')
        saveitem = file.Append(-1, '&Save Image\tCtrl+S', 'Save Image')

        menubar.Append(file, '&File')
        self.SetMenuBar(menubar)

        self.m_toolBar = self.CreateToolBar(0, -1)
        self.m_toolBar.SetToolSeparation(50)
        stepitem = self.m_toolBar.AddLabelTool(
            -1,
            '',
            self.m_art.GetBitmap(wx.ART_GO_FORWARD, wx.ART_TOOLBAR),
            shortHelp='Single step',
            longHelp='Single step in RNA commands')
        downitem = self.m_toolBar.AddLabelTool(-1,
                                               '',
                                               self.m_art.GetBitmap(
                                                   wx.ART_GO_DOWN,
                                                   wx.ART_TOOLBAR),
                                               shortHelp='Next bitmap event',
                                               longHelp='Next bitmap event')
        hereitem = self.m_toolBar.AddLabelTool(
            -1,
            '',
            self.m_art.GetBitmap(wx.ART_FIND, wx.ART_TOOLBAR),
            shortHelp='Run to selected item',
            longHelp='Run to selected item')
        self.m_toolBar.Realize()

        self.CreateStatusBar()
        self.GetStatusBar().SetFieldsCount(3)
        self.GetStatusBar().SetStatusWidths([64, 150, -1])

        # Bind events
        self.Bind(wx.EVT_MENU, self.OnOpenFile, openitem)
        self.Bind(wx.EVT_MENU, self.OnSaveImage, saveitem)
        self.Bind(wx.EVT_TOOL, self.OnStep, stepitem)
        self.Bind(wx.EVT_TOOL, self.OnNextBitmap, downitem)
        self.Bind(wx.EVT_TOOL, self.OnRunToHere, hereitem)
        self.Bind(wx.EVT_CONTEXT_MENU, self.OnRClick, self.m_rnalist)

        self.Show()
Example #12
0
    def LoadConfig(self, config):
        self.config = config
        self.scrolled.DestroyChildren()
        vbox = wx.BoxSizer(wx.VERTICAL)
        if config.setColours:
            setStaticBox = wx.StaticBox(self.scrolled,
                                        label="Colour variables")
            setStaticBoxSizer = wx.StaticBoxSizer(setStaticBox, wx.VERTICAL)

            fgs = wx.FlexGridSizer(math.ceil(len(config.setColours) / 2), 6,
                                   15, 25)
            for setColour in sorted(config.setColours):
                fgs.Add(wx.StaticText(self.scrolled, label=setColour[1:]))
                colour = config.setColours[setColour]
                cp = wx.ColourPickerCtrl(
                    self.scrolled,
                    colour=(config.setColours[colour].hex
                            if type(colour) != Color else colour.hex))
                self.Bind(
                    wx.EVT_COLOURPICKER_CHANGED,
                    lambda e, name=setColour: self.SetColourChanged(e, name),
                    cp)
                fgs.Add(cp)
                b = wx.BitmapButton(self.scrolled,
                                    bitmap=wx.ArtProvider().GetBitmap(
                                        wx.ART_DELETE))
                self.Bind(
                    wx.EVT_BUTTON,
                    lambda e, name=setColour: self.SetColourChanged(e, name),
                    b)
                fgs.Add(b)
            fgs.AddGrowableCol(2, 1)
            fgs.AddGrowableCol(5, 1)
            setStaticBoxSizer.Add(fgs,
                                  proportion=0,
                                  flag=wx.TOP | wx.LEFT | wx.BOTTOM
                                  | wx.EXPAND,
                                  border=15)
            vbox.Add(setStaticBoxSizer,
                     proportion=0,
                     flag=wx.RIGHT | wx.LEFT | wx.EXPAND,
                     border=5)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        winStaticBox = wx.StaticBox(self.scrolled, label="Windows")
        winStaticBoxSizer = wx.StaticBoxSizer(winStaticBox, wx.VERTICAL)

        fgs = wx.FlexGridSizer(1, 3, 9, 25)

        fgs.Add(wx.StaticText(self.scrolled, label="Background"), 0, 0)
        cp = wx.ColourPickerCtrl(
            self.scrolled,
            colour=config.background.hex if type(config.background) == Color
            else config.setColours[config.background].hex)
        self.Bind(wx.EVT_COLOURPICKER_CHANGED, config.backgroundChanged, cp)
        fgs.Add(cp, 0, 0)
        cb = wx.ComboBox(
            self.scrolled,
            value="Individual colour"
            if type(config.background) == Color else config.background[1:],
            choices=["Individual colour"] +
            sorted(map(lambda n: n[1:], list(config.setColours.keys()))))
        fgs.Add(cb)
        self.Bind(wx.EVT_COMBOBOX,
                  lambda e, p=cp.GetId(): self.OnColourChange(
                      e, pickerId=p, name="Background"),
                  cb)
        if type(config.background) != Color:
            cp.Disable()

        fgs.AddGrowableCol(2, 1)
        winStaticBoxSizer.Add(fgs,
                              proportion=0,
                              flag=wx.TOP | wx.LEFT | wx.EXPAND,
                              border=15)
        for colourClass in sorted(config.colourClasses):
            sb = wx.StaticBox(self.scrolled,
                              label=colourClass.replace("client.", "").replace(
                                  "_", " ").capitalize())
            boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
            fgs = wx.FlexGridSizer(4, 3, 9, 25)

            for label in ["Border", "Background", "Text", "Indicator"]:
                colour = config.colourClasses[colourClass].namedColour(label)
                fgs.Add(wx.StaticText(sb, label=label), 0, 0)
                cp = wx.ColourPickerCtrl(
                    sb,
                    colour=(config.setColours[colour].hex
                            if type(colour) != Color else colour.hex))
                self.Bind(wx.EVT_COLOURPICKER_CHANGED,
                          lambda e, colourClass=colourClass, name=label: config
                          .colourClassChanged(e, colourClass, name),
                          cp)
                fgs.Add(cp, 0, 0)
                cb = wx.ComboBox(
                    sb,
                    value="Individual colour"
                    if type(colour) == Color else colour[1:],
                    choices=["Individual colour"] + sorted(
                        map(lambda n: n[1:], list(config.setColours.keys()))))
                fgs.Add(cb)
                self.Bind(wx.EVT_COMBOBOX,
                          lambda e, p=cp.GetId(), l=label, c=colourClass: self.
                          OnColourChange(e, pickerId=p, name=l, colourClass=c),
                          cb)
                if type(colour) != Color:
                    cp.Disable()

            fgs.AddGrowableCol(1, 1)
            boxsizer.Add(fgs, flag=wx.LEFT | wx.BOTTOM | wx.TOP, border=5)
            winStaticBoxSizer.Add(boxsizer,
                                  proportion=1,
                                  flag=wx.ALL | wx.EXPAND,
                                  border=15)
        hbox.Add(winStaticBoxSizer,
                 proportion=1,
                 flag=wx.TOP | wx.BOTTOM | wx.LEFT | wx.EXPAND,
                 border=5)

        barStaticBox = wx.StaticBox(self.scrolled, label="i3Bar")
        barStaticBoxSizer = wx.StaticBoxSizer(barStaticBox, wx.VERTICAL)

        fgs = wx.FlexGridSizer(3, 3, 9, 25)

        for label in ["Background", "Status line", "Separator"]:
            fgs.Add(wx.StaticText(self.scrolled, label=label), 0, 0)

            colour = config.i3bar.namedColour(label)
            cp = wx.ColourPickerCtrl(
                self.scrolled,
                colour=(config.setColours[colour].hex
                        if type(colour) != Color else colour.hex))
            self.Bind(wx.EVT_COLOURPICKER_CHANGED,
                      lambda e, name=label: config.i3barChanged(e, name),
                      cp)
            fgs.Add(cp, 0, 0)
            cb = wx.ComboBox(
                self.scrolled,
                value="Individual colour"
                if type(colour) == Color else colour[1:],
                choices=["Individual colour"] +
                sorted(map(lambda n: n[1:], list(config.setColours.keys()))))
            fgs.Add(cb)
            self.Bind(wx.EVT_COMBOBOX,
                      lambda e, p=cp.GetId(), l=label: self.OnColourChange(
                          e, pickerId=p, name=l, i3bar=True),
                      cb)
            if type(colour) != Color:
                cp.Disable()

        fgs.AddGrowableCol(2, 1)
        barStaticBoxSizer.Add(fgs,
                              proportion=0,
                              flag=wx.ALL | wx.EXPAND,
                              border=15)

        for colourClass in sorted(config.i3bar.colourClasses):
            sb = wx.StaticBox(self.scrolled,
                              label=colourClass.replace("_", " ").capitalize())
            boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
            fgs = wx.FlexGridSizer(3, 3, 9, 25)

            for label in ["Border", "Background", "Text"]:
                fgs.Add(wx.StaticText(sb, label=label), 0, 0)
                colour = config.i3bar.colourClasses[colourClass].namedColour(
                    label)
                cp = wx.ColourPickerCtrl(
                    sb,
                    colour=(config.setColours[colour].hex
                            if type(colour) != Color else colour.hex))
                self.Bind(wx.EVT_COLOURPICKER_CHANGED,
                          lambda e, name=label, c=colourClass: config.
                          colourClassChanged(e, c, name, True),
                          cp)
                fgs.Add(cp, 0, 0)
                cb = wx.ComboBox(
                    sb,
                    value="Individual colour"
                    if type(colour) == Color else colour[1:],
                    choices=["Individual colour"] + sorted(
                        map(lambda n: n[1:], list(config.setColours.keys()))))
                fgs.Add(cb)
                self.Bind(
                    wx.EVT_COMBOBOX,
                    lambda e, p=cp.GetId(
                    ), l=label, c=colourClass: self.OnColourChange(
                        e, pickerId=p, name=l, colourClass=c, i3bar=True),
                    cb)
                if type(colour) != Color:
                    cp.Disable()

            fgs.AddGrowableCol(1, 1)
            boxsizer.Add(fgs, flag=wx.LEFT | wx.BOTTOM | wx.TOP, border=5)
            barStaticBoxSizer.Add(boxsizer,
                                  proportion=0,
                                  flag=wx.ALL | wx.EXPAND,
                                  border=15)
        hbox.Add(barStaticBoxSizer,
                 proportion=1,
                 flag=wx.ALL | wx.EXPAND,
                 border=5)
        vbox.Add(hbox, proportion=1, flag=wx.ALL | wx.EXPAND)
        self.scrolled.SetSizer(vbox)
        self.scrolled.SetupScrolling()
Example #13
0
    def __init__(self,
                 parent,
                 ID,
                 catalog,
                 title="Find in catalog",
                 size=(-1, -1),
                 pos=(-1, -1),
                 style=wx.CAPTION | wx.CLOSE_BOX | wx.RESIZE_BORDER):

        wx.Dialog.__init__(self, parent, ID, title, size, pos, style)

        self.catalog = catalog

        # main sizer
        sizer = wx.BoxSizer(wx.VERTICAL)

        # LINE 1 : text box
        upperSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.txtBox = wx.TextCtrl(self, -1, "", size=(-1, -1))
        self.txtBox.SetToolTip(
            wx.ToolTip(
                "Insert a comma separated list of strings to search for."))
        upperSizer.Add(self.txtBox, 1, wx.GROW | wx.ALL, 5)

        searchBtn = wx.Button(self, wx.ID_FIND)
        searchBtn.SetToolTip(wx.ToolTip('Search'))
        self.Bind(wx.EVT_BUTTON, self.OnSearch, id=searchBtn.GetId())
        upperSizer.Add(searchBtn, 0, wx.ALIGN_RIGHT, 5)

        sizer.Add(upperSizer, 0, wx.GROW | wx.ALL, 5)

        # LINE 2 : list

        self.list = wx.ListCtrl(self,
                                wx.NewId(),
                                style=wx.LC_REPORT | wx.LC_VRULES)

        # add columns
        self.list.InsertColumn(0, "name")
        self.list.InsertColumn(1, "device", wx.LIST_FORMAT_RIGHT)
        self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE_USEHEADER)
        self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE_USEHEADER)

        art = wx.ArtProvider()  # create the art provider
        self.imageList = wx.ImageList(16, 16)  # create the image list
        #
        # add images to list ( index starts counting from 0 )
        self.imageList.Add(art.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_MENU))
        self.imageList.Add(art.GetBitmap(wx.ART_FOLDER, wx.ART_MENU))
        #
        self.list.AssignImageList(
            self.imageList, wx.IMAGE_LIST_SMALL)  # bind image list to control

        # add list to sizer
        sizer.Add(self.list, 1, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        # LINE 3 : buttons
        btnsizer = wx.StdDialogButtonSizer()

        btn = wx.Button(self, wx.ID_CANCEL)
        btn.SetHelpText("The Cancel button cancels the dialog. (Cool, huh?)")
        btnsizer.AddButton(btn)
        btnsizer.Realize()
        sizer.Add(btnsizer, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.SetSizer(sizer)

        # set focus to
        self.txtBox.SetFocus()
Example #14
0
    def addTools(self, parent):

        art = wx.ArtProvider()

        # firstly we add a spacer to push all buttons to the right
        ##self.AddSpacer(proportion=1)

        btn = bp.ButtonInfo(self,
                            wx.NewId(),
                            art.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR),
                            shortHelp='New catalog',
                            longHelp='Create new catalog')
        self.Bind(wx.EVT_BUTTON, parent.OnNewCatalog, id=btn.GetId())
        self.AddButton(btn)

        btn = bp.ButtonInfo(self,
                            wx.NewId(),
                            art.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR),
                            shortHelp='Open catalog',
                            longHelp='Open catalog')
        self.Bind(wx.EVT_BUTTON, parent.OnOpen, id=btn.GetId())
        self.AddButton(btn)

        btn = bp.ButtonInfo(self,
                            wx.NewId(),
                            art.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR),
                            shortHelp='Save catalog',
                            longHelp='Save current catalog')
        self.Bind(wx.EVT_BUTTON, parent.OnSaveCatalog, id=btn.GetId())
        self.AddButton(btn)

        btn = bp.ButtonInfo(self,
                            wx.NewId(),
                            art.GetBitmap(wx.ART_ADD_BOOKMARK, wx.ART_TOOLBAR),
                            shortHelp='Add device',
                            longHelp='Add a new device')
        self.Bind(wx.EVT_BUTTON, parent.OnAddDevice, id=btn.GetId())
        self.AddButton(btn)

        btn = bp.ButtonInfo(self,
                            wx.NewId(),
                            art.GetBitmap(wx.ART_DEL_BOOKMARK, wx.ART_TOOLBAR),
                            shortHelp='Delete device',
                            longHelp='Delete selected device')
        self.Bind(wx.EVT_BUTTON, parent.OnDelDevice, id=btn.GetId())
        self.AddButton(btn)

        btn = bp.ButtonInfo(self,
                            wx.NewId(),
                            art.GetBitmap(wx.ART_FIND, wx.ART_TOOLBAR),
                            shortHelp='Find',
                            longHelp='Find in current catalog')
        self.Bind(wx.EVT_BUTTON, parent.OnSearch, id=btn.GetId())
        self.AddButton(btn)

        self.AddSeparator()

        btn = bp.ButtonInfo(self,
                            wx.NewId(),
                            art.GetBitmap(wx.ART_QUIT, wx.ART_TOOLBAR),
                            shortHelp='Quit',
                            longHelp='Quit application')
        self.Bind(wx.EVT_BUTTON, parent.OnQuit, id=btn.GetId())
        self.AddButton(btn)