Python wx.ART_TOOLBAR Examples

The following are 6 code examples of wx.ART_TOOLBAR(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: sct_plugin.py    From spinalcordtoolbox with MIT License 6 votes vote down vote up
def __init__(self, parent):
        # TODO: try to use MessageBox instead, as they already include buttons, icons, etc.
        wx.Dialog.__init__(self, parent, title="SCT Processing")
        self.SetSize((300, 120))

        vbox = wx.BoxSizer(wx.VERTICAL)
        lbldesc = wx.StaticText(self, id=wx.ID_ANY, label="Processing, please wait...")
        vbox.Add(lbldesc, 0, wx.ALIGN_LEFT | wx.ALL, 10)

        btns = self.CreateSeparatedButtonSizer(wx.CANCEL)
        vbox.Add(btns, 0, wx.ALIGN_LEFT | wx.ALL, 5)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        # TODO: use a nicer image, showing two gears (similar to ID_EXECUTE)
        save_ico = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR, (50, 50))
        img_info = wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth(), save_ico.GetHeight()))

        hbox.Add(img_info, 0, wx.ALL, 10)
        hbox.Add(vbox, 0, wx.ALL, 0)

        self.SetSizer(hbox)
        self.Centre()
        self.CenterOnParent()
        # TODO: retrieve action from the cancel button 
Example #2
Source File: configuration_dialogs.py    From superpaper with MIT License 5 votes vote down vote up
def add_to_imagelist(self, path):
        folder_bmp =  wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_TOOLBAR, self.tsize)
        # file_bmp =  wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_TOOLBAR, self.tsize)
        if os.path.isdir(path):
            img_id = self.il.Add(folder_bmp)
        else:
            thumb_bmp = self.create_thumb_bmp(path)
            img_id = self.il.Add(thumb_bmp)
        return img_id 
Example #3
Source File: gui.py    From superpaper with MIT License 5 votes vote down vote up
def add_to_imagelist(self, path):
        folder_bmp =  wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_TOOLBAR, self.tsize)
        if os.path.isdir(path):
            img_id = self.image_list.Add(folder_bmp)
        else:
            thumb_bmp = self.create_thumb_bmp(path)
            img_id = self.image_list.Add(thumb_bmp)
        return img_id 
Example #4
Source File: sct_plugin.py    From spinalcordtoolbox with MIT License 5 votes vote down vote up
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, title="SCT Error")
        self.SetSize((510, 170))

        vbox = wx.BoxSizer(wx.VERTICAL)
        lbldesc = wx.StaticText(self,
                                id=-1,
                                label="An error has occurred while running SCT. Please go to the Terminal, copy all "
                                      "the content and paste it as a new issue in SCT's forum: \n"
                                      "http://forum.spinalcordmri.org/",
                                size=wx.Size(470, 60),
                                style=wx.ALIGN_LEFT)
        vbox.Add(lbldesc, 0, wx.ALIGN_LEFT | wx.ALL, 10)

        btns = self.CreateSeparatedButtonSizer(wx.OK)
        vbox.Add(btns, 0, wx.ALIGN_LEFT | wx.ALL, 5)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        save_ico = wx.ArtProvider.GetBitmap(wx.ART_ERROR, wx.ART_TOOLBAR, (50, 50))
        img_info = wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth(), save_ico.GetHeight()))

        hbox.Add(img_info, 0, wx.ALL, 10)
        hbox.Add(vbox, 0, wx.ALL, 0)

        self.SetSizer(hbox)
        self.Centre()
        self.CenterOnParent() 
Example #5
Source File: DownloadManager.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, ops=[], *a, **k):
        size = wx.the_app.config['toolbar_size']
        self.size = size

        style = self.default_style
        config = wx.the_app.config
        if config['toolbar_text']:
            style |= wx.TB_TEXT

        wx.ToolBar.__init__(self, parent, style=style, **k)

        self.SetToolBitmapSize((size,size))

        while ops:
            opset = ops.pop(0)
            for e in opset:
                if issubclass(type(e.image), (str,unicode)):
                    bmp = wx.ArtProvider.GetBitmap(e.image, wx.ART_TOOLBAR, (size,size))
                elif type(e.image) is tuple:
                    i = wx.the_app.theme_library.get(e.image, self.size)
                    bmp = wx.BitmapFromImage(i)
                    assert bmp.Ok(), "The image (%s) is not valid." % i
                self.AddLabelTool(e.id, e.label, bmp, shortHelp=e.shorthelp)

            if len(ops):
                self.AddSeparator()

        self.Realize() 
Example #6
Source File: runsnake.py    From pyFileFixity with MIT License 4 votes vote down vote up
def SetupToolBar(self):
        """Create the toolbar for common actions"""
        tb = self.CreateToolBar(self.TBFLAGS)
        tsize = (24, 24)
        tb.ToolBitmapSize = tsize
        open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR,
                                            tsize)
        tb.AddLabelTool(ID_OPEN, "Open", open_bmp, shortHelp="Open",
                        longHelp="Open a (c)Profile trace file")
        if not osx:
            tb.AddSeparator()
#        self.Bind(wx.EVT_TOOL, self.OnOpenFile, id=ID_OPEN)
        self.rootViewTool = tb.AddLabelTool(
            ID_ROOT_VIEW, _("Root View"),
            wx.ArtProvider.GetBitmap(wx.ART_GO_HOME, wx.ART_TOOLBAR, tsize),
            shortHelp=_("Display the root of the current view tree (home view)")
        )
        self.rootViewTool = tb.AddLabelTool(
            ID_BACK_VIEW, _("Back"),
            wx.ArtProvider.GetBitmap(wx.ART_GO_BACK, wx.ART_TOOLBAR, tsize),
            shortHelp=_("Back to the previously activated node in the call tree")
        )
        self.upViewTool = tb.AddLabelTool(
            ID_UP_VIEW, _("Up"),
            wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_TOOLBAR, tsize),
            shortHelp=_("Go one level up the call tree (highest-percentage parent)")
        )
        if not osx:
            tb.AddSeparator()
        # TODO: figure out why the control is sizing the label incorrectly on Linux
        self.percentageViewTool = wx.CheckBox(tb, -1, _("Percent    "))
        self.percentageViewTool.SetToolTip(wx.ToolTip(
            _("Toggle display of percentages in list views")))
        tb.AddControl(self.percentageViewTool)
        wx.EVT_CHECKBOX(self.percentageViewTool,
                        self.percentageViewTool.GetId(), self.OnPercentageView)

        self.viewTypeTool= wx.Choice( tb, -1, choices= getattr(self.loader,'ROOTS',[]) )
        self.viewTypeTool.SetToolTip(wx.ToolTip(
            _("Switch between different hierarchic views of the data")))
        wx.EVT_CHOICE( self.viewTypeTool, self.viewTypeTool.GetId(), self.OnViewTypeTool )
        tb.AddControl( self.viewTypeTool )
        tb.Realize()