Python wx.BitmapButton() Examples

The following are 30 code examples of wx.BitmapButton(). 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: FontSelectButton.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(
        self,
        parent,
        id=-1,
        pos=wx.DefaultPosition,
        size=(40, wx.Button.GetDefaultSize()[1]),
        style=wx.BU_AUTODRAW,
        validator=wx.DefaultValidator,
        name="FontSelectButton",
        value=None
    ):
        self.value = value
        wx.BitmapButton.__init__(
            self,
            parent,
            id,
            GetInternalBitmap("font"),
            pos,
            size,
            style,
            validator,
            name
        )
        self.Bind(wx.EVT_BUTTON, self.OnButton) 
Example #2
Source File: gui.py    From superpaper with MIT License 6 votes vote down vote up
def create_buttons(self, use_ppi_px):
        """Create buttons for display preview positioning config."""
        # Buttons - show only if use_ppi_px == True
        self.button_config = wx.Button(self, label="Positions")
        self.button_save = wx.Button(self, label="Save")
        self.button_reset = wx.Button(self, label="Reset")
        self.button_cancel = wx.Button(self, label="Cancel")
        help_bmp = wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_BUTTON, (20, 20))
        self.button_help = wx.BitmapButton(self, bitmap=help_bmp, name="butt_help")


        self.button_config.Bind(wx.EVT_BUTTON, self.onConfigure)
        self.button_save.Bind(wx.EVT_BUTTON, self.onSave)
        self.button_reset.Bind(wx.EVT_BUTTON, self.onReset)
        self.button_cancel.Bind(wx.EVT_BUTTON, self.onCancel)
        self.button_help.Bind(wx.EVT_BUTTON, self.onHelp)

        self.move_buttons()

        self.button_config.Show(use_ppi_px)
        self.button_save.Show(False)
        self.button_reset.Show(False)
        self.button_cancel.Show(False) 
Example #3
Source File: ColourSelectButton.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(
        self,
        parent,
        value=(255, 255, 255),
        pos=wx.DefaultPosition,
        size=(40, wx.Button.GetDefaultSize()[1]),
        style=wx.BU_AUTODRAW,
        validator=wx.DefaultValidator,
        name="ColourSelectButton",
        title = "Colour Picker"
    ):
        self.value = value
        self.title = title
        wx.BitmapButton.__init__(
            self, parent, -1, wx.NullBitmap, pos, size, style, validator, name
        )
        self.SetValue(value)
        self.Bind(wx.EVT_BUTTON, self.OnButton) 
Example #4
Source File: mathtext_wx_sgskip.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_buttonbar(self):
        self.button_bar = wx.Panel(self)
        self.button_bar_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self.button_bar, 0, wx.LEFT | wx.TOP | wx.GROW)

        for i, (mt, func) in enumerate(functions):
            bm = mathtext_to_wxbitmap(mt)
            button = wx.BitmapButton(self.button_bar, 1000 + i, bm)
            self.button_bar_sizer.Add(button, 1, wx.GROW)
            self.Bind(wx.EVT_BUTTON, self.OnChangePlot, button)

        self.button_bar.SetSizer(self.button_bar_sizer) 
Example #5
Source File: DeviceManager.py    From meerk40t with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: DeviceManager.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((707, 337))
        self.devices_list = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_HRULES | wx.LC_REPORT | wx.LC_VRULES)
        self.new_device_button = wx.BitmapButton(self, wx.ID_ANY, icons8_plus_50.GetBitmap())
        self.remove_device_button = wx.BitmapButton(self, wx.ID_ANY, icons8_trash_50.GetBitmap())
        self.device_properties_button = wx.BitmapButton(self, wx.ID_ANY, icons8_administrative_tools_50.GetBitmap())
        self.move_item_up_button = wx.BitmapButton(self, wx.ID_ANY, icons8up.GetBitmap())
        self.move_item_down_button = wx.BitmapButton(self, wx.ID_ANY, icons8_down.GetBitmap())

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_LIST_BEGIN_DRAG, self.on_list_drag, self.devices_list)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.on_list_item_activated, self.devices_list)
        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.on_list_right_click, self.devices_list)
        self.Bind(wx.EVT_BUTTON, self.on_button_new, self.new_device_button)
        self.Bind(wx.EVT_BUTTON, self.on_button_remove, self.remove_device_button)
        self.Bind(wx.EVT_BUTTON, self.on_button_properties, self.device_properties_button)
        self.Bind(wx.EVT_BUTTON, self.on_button_up, self.move_item_up_button)
        self.Bind(wx.EVT_BUTTON, self.on_button_down, self.move_item_down_button)
        # end wxGlade

        self.Bind(wx.EVT_CLOSE, self.on_close, self) 
Example #6
Source File: About.py    From meerk40t with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: About.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP
        wx.Frame.__init__(self, *args, **kwds)
        Module.__init__(self)
        self.SetSize((699, 442))
        self.bitmap_button_1 = wx.BitmapButton(self, wx.ID_ANY, icon_meerk40t.GetBitmap())

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self) 
Example #7
Source File: FileBrowseButton.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def createBrowseButton(self):
        """
        Create the browse-button control
        """
        button = wx.BitmapButton(self, -1, GetInternalBitmap("searchFolder"))
        width, height = button.GetSize()
        button.SetMinSize((width + 8, height))
        button.SetToolTipString(self.toolTip)
        button.Bind(wx.EVT_BUTTON, self.OnBrowse)
        return button 
Example #8
Source File: main.py    From python-examples with MIT License 5 votes vote down vote up
def InitUI(self):
            
        img_color = wx.Image('Obrazy/furas.png')
        img_grey = img_color.ConvertToGreyscale(0.3, 0.3, 0.3)
        
        self.hbox = wx.BoxSizer(wx.HORIZONTAL)
        
        self.panel = wx.Panel(self)
        self.panel.SetSizer(self.hbox)

        self.bitmap_color = wx.Bitmap(img_color)
        self.bitmap_grey = wx.Bitmap(img_grey)

        #self.image = wx.StaticBitmap(self.panel, 1, self.bitmap_color)
        self.image = wx.BitmapButton(self.panel, 1, self.bitmap_color, style=wx.BORDER_NONE)
        # use 0 to not resize image to full window        
        self.hbox.Add(self.image, 0)

        # binds don't work on Linux for StaticBitmap
        # but they works for BitmapButton (but Button has border)
        self.image.Bind(wx.EVT_ENTER_WINDOW, self.OnOver)
        self.image.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)

        # set color to see how many space use it
        self.panel.SetBackgroundColour((0,255,0))
        # set color to see how many space use it
        self.image.SetBackgroundColour((255,0,0)) 
Example #9
Source File: bitmap_button.py    From wxGlade with MIT License 5 votes vote down vote up
def create_widget(self):
        bmp = self.get_preview_obj_bitmap()
        self.widget = wx.BitmapButton(self.parent_window.widget, self.id, bmp, style=self.style)
        self._set_preview_bitmaps() 
Example #10
Source File: tree_ctrl.py    From wxGlade with MIT License 5 votes vote down vote up
def initialize():
    "initialization function for the module: returns a wx.BitmapButton to be added to the main palette"
    common.widget_classes['EditTreeCtrl'] = EditTreeCtrl
    common.widgets['EditTreeCtrl'] = builder
    common.widgets_from_xml['EditTreeCtrl'] = xml_builder

    return common.make_object_button('EditTreeCtrl', 'tree_ctrl.xpm') 
Example #11
Source File: frame.py    From wxGlade with MIT License 5 votes vote down vote up
def initialize():
    "initialization function for the module: returns a wx.BitmapButton to be added to the main palette"
    common.widget_classes['EditFrame'] = EditFrame
    common.widgets['EditFrame'] = builder
    common.widgets_from_xml['EditFrame'] = xml_builder

    common.widget_classes['EditMDIChildFrame'] = EditMDIChildFrame
    common.widgets_from_xml['EditMDIChildFrame'] = xml_builder

    return common.make_object_button('EditFrame', 'frame.xpm', 1) 
Example #12
Source File: radio_box.py    From wxGlade with MIT License 5 votes vote down vote up
def initialize():
    "initialization function for the module: returns a wx.BitmapButton to be added to the main palette"
    common.widget_classes['EditRadioBox'] = EditRadioBox
    common.widgets['EditRadioBox'] = builder
    common.widgets_from_xml['EditRadioBox'] = xml_builder

    return common.make_object_button('EditRadioBox', 'radio_box.xpm') 
Example #13
Source File: radio_button.py    From wxGlade with MIT License 5 votes vote down vote up
def initialize():
    "initialization function for the module: returns a wx.BitmapButton to be added to the main palette"
    common.widget_classes['EditRadioButton'] = EditRadioButton
    common.widgets['EditRadioButton'] = builder
    common.widgets_from_xml['EditRadioButton'] = xml_builder

    return common.make_object_button('EditRadioButton', 'radio_button.xpm') 
Example #14
Source File: menubar.py    From wxGlade with MIT License 5 votes vote down vote up
def initialize():
    "initialization function for the module: returns a wx.BitmapButton to be added to the main palette"
    common.widget_classes['EditMenuBar'] = EditMenuBar
    common.widgets['EditMenuBar'] = builder
    common.widgets_from_xml['EditMenuBar'] = xml_builder

    return common.make_object_button('EditMenuBar', 'menubar.xpm', 1) 
Example #15
Source File: checkbox.py    From wxGlade with MIT License 5 votes vote down vote up
def initialize():
    "initialization function for the module: returns a wx.BitmapButton to be added to the main palette"
    common.widget_classes['EditCheckBox'] = EditCheckBox
    common.widgets['EditCheckBox'] = builder
    common.widgets_from_xml['EditCheckBox'] = xml_builder

    return common.make_object_button('EditCheckBox', 'checkbox.xpm') 
Example #16
Source File: main.py    From Spider with Apache License 2.0 5 votes vote down vote up
def __init__(self, frame, pnl, item):
        pic_jd = wx.Image(item.img, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        btn_jd = wx.BitmapButton(pnl, -1, pic_jd, pos=(item.x, item.y), size=(100, 100))
        wx.StaticText(pnl, -1, item.title, pos=(item.x + 30, item.y + 110))
        self.frame = frame
        self.frame.Bind(wx.EVT_BUTTON, self.OnClick, btn_jd) 
Example #17
Source File: gui.py    From superpaper with MIT License 5 votes vote down vote up
def create_bezel_buttons(self):
        # load icons into bitmaps
        rb_png = os.path.join(RESOURCES_PATH, "icons8-merge-vertical-96.png")
        bb_png = os.path.join(RESOURCES_PATH, "icons8-merge-horizontal-96.png")
        rb_img = wx.Image(rb_png, type=wx.BITMAP_TYPE_ANY)
        bb_img = wx.Image(bb_png, type=wx.BITMAP_TYPE_ANY)
        rb_bmp = rb_img.Scale(20, 20).Resize((20, 20), (0, 0)).ConvertToBitmap()
        bb_bmp = bb_img.Scale(20, 20).Resize((20, 20), (0, 0)).ConvertToBitmap()

        # create bitmap buttons
        for st_bmp in self.preview_img_list:
            butts = []
            butt_rb = wx.BitmapButton(self, bitmap=rb_bmp, name="butt_bez_r", style=wx.BORDER_NONE)
            butt_bb = wx.BitmapButton(self, bitmap=bb_bmp, name="butt_bez_b", style=wx.BORDER_NONE)
            bez_butt_color = wx.Colour(41, 47, 52)
            butt_rb.SetBackgroundColour(bez_butt_color)
            butt_bb.SetBackgroundColour(bez_butt_color)
            self.bez_butt_sz = butt_rb.GetSize()
            pos_rb, pos_bb = self.bezel_button_positions(st_bmp)
            butt_rb.SetPosition((pos_rb[0], pos_rb[1]))
            butt_bb.SetPosition((pos_bb[0], pos_bb[1]))
            butt_rb.Bind(wx.EVT_BUTTON, self.onBezelButton)
            butt_bb.Bind(wx.EVT_BUTTON, self.onBezelButton)
            self.bez_buttons.append(
                (
                    butt_rb,
                    butt_bb
                )
            )
        self.show_bezel_buttons(False)
        self.create_bezel_popups() 
Example #18
Source File: mainframe.py    From youtube-dl-gui with The Unlicense 5 votes vote down vote up
def _create_bitmap_button(self, icon, size=(-1, -1), handler=None):
        button = wx.BitmapButton(self._panel, bitmap=icon, size=size, style=wx.NO_BORDER)

        if handler is not None:
            button.Bind(wx.EVT_BUTTON, handler)

        return button 
Example #19
Source File: wxwrap.py    From grass-tangible-landscape with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        wx.BitmapButton.__init__(self, *args, **kwargs) 
Example #20
Source File: wxwrap.py    From grass-tangible-landscape with GNU General Public License v2.0 5 votes vote down vote up
def SetToolTip(self, tip):
        if wxPythonPhoenix:
            wx.BitmapButton.SetToolTip(self, tipString=tip)
        else:
            wx.BitmapButton.SetToolTipString(self, tip) 
Example #21
Source File: custom_widget.py    From wxGlade with MIT License 5 votes vote down vote up
def initialize():
    "initialization function for the module: returns a wx.BitmapButton to be added to the main palette"
    common.widget_classes['CustomWidget'] = CustomWidget
    common.widgets['CustomWidget'] = builder
    common.widgets_from_xml['CustomWidget'] = xml_builder

    return common.make_object_button('CustomWidget', 'custom.xpm', tip='Add a custom widget') 
Example #22
Source File: property_grid_manager.py    From wxGlade with MIT License 5 votes vote down vote up
def initialize():
    "initialization function for the module: returns a wx.BitmapButton to be added to the main palette"
    common.widget_classes['EditPropertyGridManager'] = EditPropertyGridManager
    common.widgets['EditPropertyGridManager'] = builder
    common.widgets_from_xml['EditPropertyGridManager'] = xml_builder

    return common.make_object_button('EditPropertyGridManager', 'grid.xpm') 
Example #23
Source File: static_bitmap.py    From wxGlade with MIT License 5 votes vote down vote up
def initialize():
    "initialization function for the module: returns a wx.BitmapButton to be added to the main palette"
    common.widget_classes['EditStaticBitmap'] = EditStaticBitmap
    common.widgets['EditStaticBitmap'] = builder
    common.widgets_from_xml['EditStaticBitmap'] = xml_builder

    return common.make_object_button('EditStaticBitmap', 'static_bitmap.xpm') 
Example #24
Source File: common.py    From wxGlade with MIT License 4 votes vote down vote up
def make_object_button(widget, icon_path, toplevel=False, tip=None):
    """Creates a button for the widgets toolbar.

    Function used by the various widget modules to add a button to the widgets toolbar.

    Icons with a relative path will be loaded from config.icon_path.

    widget: (name of) the widget the button will add to the app 
    icon_path: Path to the icon_path used for the button
    toplevel: True if the widget is a toplevel object (frame, dialog)
    tip: Tool tip to display

    return: The newly created wxBitmapButton instance"""
    if not config.use_gui: return None
    import wx
    import misc
    from tree import WidgetTree

    if not os.path.isabs(icon_path):
        icon_path = os.path.join(config.icons_path, icon_path)
    bmp = misc.get_xpm_bitmap(icon_path)
    label = widget.replace('Edit', '')
    if compat.version < (3,0):
        # old wx version: use BitmapButton
        tmp = wx.BitmapButton(palette, -1, bmp, size=(31,31))
        if not toplevel:
            tmp.Bind(wx.EVT_BUTTON, add_object)
        else:
            tmp.Bind(wx.EVT_BUTTON, add_toplevel_object)
    else:
        # for more recent versions, we support config options to display icons and/or labels
        if not toplevel:
            if not config.preferences.show_palette_labels:
                # icons only -> set size
                tmp = wx.ToggleButton(palette, -1, size=(31,31), name=label)
            else:
                tmp = wx.ToggleButton(palette, -1, label, name=label )
            tmp.Bind(wx.EVT_TOGGLEBUTTON, add_object)
        else:
            if not config.preferences.show_palette_labels:
                tmp = wx.Button(palette, -1, size=(31,31), name=label)
            else:
                tmp = wx.Button(palette, -1, label, name=label )
            tmp.Bind(wx.EVT_BUTTON, add_toplevel_object)
        if config.preferences.show_palette_icons:
            tmp.SetBitmap( bmp )
    refs[tmp.GetId()] = widget
    if not tip:
        tip = _('Add a %s') % label
    tmp.SetToolTip(wx.ToolTip(tip))

    WidgetTree.images[widget] = icon_path

    return tmp 
Example #25
Source File: Main_Dialog_OLD.py    From topoflow with MIT License 4 votes vote down vote up
def Get_Navigation_Panel(self):

        #----------------------------------
        # Create a new panel with a sizer
        #----------------------------------
        panel = wx.Panel(self)
        panel.SetBackgroundColour('Light Blue')
        self.navigation_panel = panel
        sizer = wx.GridSizer(2, 2, self.hgap, self.vgap)
        panel.SetSizer(sizer)
        
        #-----------------------------------
        # Can we find the button bitmaps ?
        #-----------------------------------
        
        #-------------------------
        # Get the button bitmaps
        #-------------------------
        bmp_nx    = 168
        bmp_ny    = 128
        bmp_file1 = self.bmp_dir + "TF_Button1.bmp"
        bmp_file2 = self.bmp_dir + "TF_Button2.bmp"
        bmp_file3 = self.bmp_dir + "TF_Button3.bmp"
        bmp_file4 = self.bmp_dir + "TF_Button4.bmp"
        bmp1 = wx.Image(bmp_file1, wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        bmp2 = wx.Image(bmp_file2, wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        bmp3 = wx.Image(bmp_file3, wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        bmp4 = wx.Image(bmp_file4, wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        #-----------------------------------------------------------------
        new_button  = wx.BitmapButton(panel, -1, bmp1)
        pre_button  = wx.BitmapButton(panel, -1, bmp2)
        plot_button = wx.BitmapButton(panel, -1, bmp3)
        exit_button = wx.BitmapButton(panel, -1, bmp4)
        #-----------------------------------------------------------------
        proportion = 0
        flag   = wx.ALIGN_CENTER  # (affects resizing by user)
        border = 10
        sizer.Add(new_button,  proportion, flag, border)
        sizer.Add(pre_button,  proportion, flag, border)
        sizer.Add(plot_button, proportion, flag, border)
        sizer.Add(exit_button, proportion, flag, border)
        #------------------------------------------------------------------
        self.Bind(wx.EVT_BUTTON, self.On_Goto_New_Run,       new_button)
        self.Bind(wx.EVT_BUTTON, self.On_Goto_Preprocessing, pre_button)
        self.Bind(wx.EVT_BUTTON, self.On_Goto_Plotting,      plot_button)
        self.Bind(wx.EVT_BUTTON, self.On_File_Exit,          exit_button)

        #------------------------------------
        # Main panel is displayed at start,
        # but other panels are hidden
        #------------------------------------
        sizer.Fit(self)
        panel.Show()
        ## sizer.Show(True)    # (also works)
        
    #   Get_Navigation_Panel()
    #---------------------------------------------------------------- 
Example #26
Source File: Main_Dialog.py    From topoflow with MIT License 4 votes vote down vote up
def Add_Navigation_Panel(self):

        #----------------------------------
        # Create a new panel with a sizer
        #----------------------------------
        panel = self.main_panel
        hgap  = 20
        vgap  = 15
        sizer = wx.GridSizer(2, 2, hgap, vgap)
        self.navigation_sizer = sizer
        
        #-----------------------------------
        # Can we find the button bitmaps ?
        #-----------------------------------
        
        #-------------------------
        # Get the button bitmaps
        #-------------------------
        bmp_nx    = 168
        bmp_ny    = 128
        bmp_file1 = self.bmp_dir + "TF_Button1.bmp"
        bmp_file2 = self.bmp_dir + "TF_Button2.bmp"
        bmp_file3 = self.bmp_dir + "TF_Button3.bmp"
        bmp_file4 = self.bmp_dir + "TF_Button4.bmp"
        bmp1 = wx.Image(bmp_file1, wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        bmp2 = wx.Image(bmp_file2, wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        bmp3 = wx.Image(bmp_file3, wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        bmp4 = wx.Image(bmp_file4, wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        #-----------------------------------------------------------------
        new_button  = wx.BitmapButton(panel, -1, bmp1)
        pre_button  = wx.BitmapButton(panel, -1, bmp2)
        plot_button = wx.BitmapButton(panel, -1, bmp3)
        exit_button = wx.BitmapButton(panel, -1, bmp4)
        #-----------------------------------------------------------------
        proportion = 0
        # flag   = wx.ALIGN_CENTER  # (affects resizing by user)
        flag   = wx.ALL
        border = 20
        sizer.Add(new_button,  proportion, flag, border)
        sizer.Add(pre_button,  proportion, flag, border)
        sizer.Add(plot_button, proportion, flag, border)
        sizer.Add(exit_button, proportion, flag, border)
        #------------------------------------------------------------------
        self.Bind(wx.EVT_BUTTON, self.On_Goto_Run_Info,      new_button)
        self.Bind(wx.EVT_BUTTON, self.On_Goto_Preprocessing, pre_button)
        self.Bind(wx.EVT_BUTTON, self.On_Goto_Plotting,      plot_button)
        self.Bind(wx.EVT_BUTTON, self.On_File_Exit,          exit_button)

        #---------------------------------------
        # Add run_info_sizer to the main_sizer
        #---------------------------------------
        self.main_sizer.Add(sizer, 0, wx.ALL, self.vgap)
        self.main_sizer.Hide(sizer)
        
    #   Add_Navigation_Panel()
    #---------------------------------------------------------------- 
Example #27
Source File: gui.py    From atbswp with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, *args, **kwds):
        """Build the interface."""
        if getattr(sys, 'frozen', False):
            self.path = sys._MEIPASS
        else:
            self.path = Path(__file__).parent.absolute()
        on_top = wx.DEFAULT_DIALOG_STYLE
        on_top = on_top if not settings.CONFIG.getboolean('DEFAULT', 'Always On Top') \
                        else on_top | wx.STAY_ON_TOP
        kwds["style"] = kwds.get("style", 0) | on_top
        wx.Dialog.__init__(self, *args, **kwds)
        self.panel = wx.Panel(self)
        self.icon = wx.Icon(os.path.join(self.path, "img", "icon.png"))
        self.SetIcon(self.icon)
        self.taskbar = TaskBarIcon(self)
        self.taskbar.SetIcon(self.icon, "atbswp")

        locale = self.__load_locale()
        self.app_text, self.settings_text = locale[:7], locale[7:]
        self.file_open_button = wx.BitmapButton(self,
                                                wx.ID_ANY,
                                                wx.Bitmap(os.path.join(self.path, "img", "file-upload.png"),
                                                          wx.BITMAP_TYPE_ANY))
        self.file_open_button.SetToolTip(self.app_text[0])
        self.save_button = wx.BitmapButton(self,
                                           wx.ID_ANY,
                                           wx.Bitmap(os.path.join(self.path, "img", "save.png"),
                                                     wx.BITMAP_TYPE_ANY))
        self.save_button.SetToolTip(self.app_text[1])
        self.record_button = wx.BitmapToggleButton(self,
                                                   wx.ID_ANY,
                                                   wx.Bitmap(os.path.join(self.path, "img", "video.png"),
                                                             wx.BITMAP_TYPE_ANY))
        self.record_button.SetToolTip(self.app_text[2])
        self.play_button = wx.BitmapToggleButton(self,
                                                 wx.ID_ANY,
                                                 wx.Bitmap(os.path.join(self.path, "img", "play-circle.png"),
                                                           wx.BITMAP_TYPE_ANY))
        self.play_button.SetToolTip(self.app_text[3])
        self.compile_button = wx.BitmapButton(self,
                                              wx.ID_ANY,
                                              wx.Bitmap(os.path.join(self.path, "img", "download.png"),
                                                        wx.BITMAP_TYPE_ANY))
        self.compile_button.SetToolTip(self.app_text[4])
        self.settings_button = wx.BitmapButton(self,
                                               wx.ID_ANY,
                                               wx.Bitmap(os.path.join(self.path, "img", "cog.png"),
                                                         wx.BITMAP_TYPE_ANY))
        self.settings_button.SetToolTip(self.app_text[5])

        self.help_button = wx.BitmapButton(self,
                                           wx.ID_ANY,
                                           wx.Bitmap(os.path.join(self.path, "img", "question-circle.png"),
                                                     wx.BITMAP_TYPE_ANY))
        self.help_button.SetToolTip(self.app_text[6])

        self.__add_bindings()
        self.__set_properties()
        self.__do_layout() 
Example #28
Source File: configuration_dialogs.py    From superpaper with MIT License 4 votes vote down vote up
def create_display_opts(self, num_disps):
        """Create sizer for display perspective options."""
        self.sizer_disp_opts = wx.StaticBoxSizer(wx.HORIZONTAL, self,
                                                 "Display perspective configuration")
        statbox_disp_opts = self.sizer_disp_opts.GetStaticBox()
        cols = 8
        gap = 5
        self.grid = wx.FlexGridSizer(cols, gap, gap)

        # header
        hd_id = wx.StaticText(statbox_disp_opts, -1, "Display")
        hd_sax = wx.StaticText(statbox_disp_opts, -1, "Swivel axis")
        hd_san = wx.StaticText(statbox_disp_opts, -1, "Swivel angle")
        hd_sol = wx.StaticText(statbox_disp_opts, -1, "Sw. ax. lat. off.")
        hd_sod = wx.StaticText(statbox_disp_opts, -1, "Sw. ax. dep. off.")
        hd_tan = wx.StaticText(statbox_disp_opts, -1, "Tilt angle")
        hd_tov = wx.StaticText(statbox_disp_opts, -1, "Ti. ax. ver. off.")
        hd_tod = wx.StaticText(statbox_disp_opts, -1, "Ti. ax. dep. off.")
        self.grid.Add(hd_id, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 1)
        self.grid.Add(hd_sax, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 1)
        self.grid.Add(hd_san, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 1)
        self.grid.Add(hd_sol, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 1)
        self.grid.Add(hd_sod, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 1)
        self.grid.Add(hd_tan, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 1)
        self.grid.Add(hd_tov, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 1)
        self.grid.Add(hd_tod, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 1)

        # Fill grid rows
        self.grid_rows = []
        for i in range(num_disps):
            row = self.display_opt_widget_row(i)
            self.grid_rows.append(row)
            sizer_row = [(item, 0, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 1)
                         for item in row]
            self.grid.AddMany(sizer_row)

        # Build sizer
        self.sizer_disp_opts.Add(self.grid, 0, wx.ALL|wx.EXPAND, 5)

        # help
        self.button_help_data = wx.BitmapButton(statbox_disp_opts, bitmap=self.help_bmp)
        self.button_help_data.Bind(wx.EVT_BUTTON, self.onHelpData)
        self.sizer_disp_opts.AddStretchSpacer()
        self.sizer_disp_opts.Add(self.button_help_data, 0,
                                 wx.ALIGN_TOP|wx.RIGHT, 5) 
Example #29
Source File: Controller.py    From meerk40t with MIT License 4 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: Controller.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP
        wx.Frame.__init__(self, *args, **kwds)
        Module.__init__(self)
        self.SetSize((499, 505))
        self.button_controller_control = wx.Button(self, wx.ID_ANY, _("Start Controller"))
        self.text_controller_status = wx.TextCtrl(self, wx.ID_ANY, "")
        self.button_device_connect = wx.Button(self, wx.ID_ANY, _("Connection"))
        self.text_connection_status = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_device = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_location = wx.TextCtrl(self, wx.ID_ANY, "")
        self.gauge_buffer = wx.Gauge(self, wx.ID_ANY, 10)
        self.checkbox_limit_buffer = wx.CheckBox(self, wx.ID_ANY, _("Limit Write Buffer"))
        self.text_buffer_length = wx.TextCtrl(self, wx.ID_ANY, "")
        self.spin_packet_buffer_max = wx.SpinCtrl(self, wx.ID_ANY, "1500", min=1, max=100000)
        self.button_buffer_viewer = wx.BitmapButton(self, wx.ID_ANY, icons8_comments_50.GetBitmap())
        self.packet_count_text = wx.TextCtrl(self, wx.ID_ANY, "")
        self.rejected_packet_count_text = wx.TextCtrl(self, wx.ID_ANY, "")
        self.packet_text_text = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_byte_0 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_byte_1 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_desc = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_byte_2 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_byte_3 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_byte_4 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_byte_5 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.button_pause = wx.BitmapButton(self, wx.ID_ANY, icons8_pause_50.GetBitmap())
        self.button_stop = wx.BitmapButton(self, wx.ID_ANY, icons8_stop_sign_50.GetBitmap())

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.on_button_connect, self.button_device_connect)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_limit_packet_buffer, self.checkbox_limit_buffer)
        self.Bind(wx.EVT_SPINCTRL, self.on_spin_packet_buffer_max, self.spin_packet_buffer_max)
        self.Bind(wx.EVT_TEXT, self.on_spin_packet_buffer_max, self.spin_packet_buffer_max)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_packet_buffer_max, self.spin_packet_buffer_max)
        self.Bind(wx.EVT_BUTTON, lambda e: self.device.open('window', "BufferView", None, -1, ""), self.button_buffer_viewer)
        self.Bind(wx.EVT_BUTTON, self.on_button_pause_resume, self.button_pause)
        self.Bind(wx.EVT_BUTTON, self.on_button_emergency_stop, self.button_stop)
        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
        self.Bind(wx.EVT_RIGHT_DOWN, self.on_controller_menu, self)
        self.buffer_max = 1
        self.last_control_state = None 
Example #30
Source File: configuration_dialogs.py    From superpaper with MIT License 4 votes vote down vote up
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, -1,
                           'Configure wallpaper perspective rotations',
                           #    size=(750, 850)
                          )
        self.tc_width = 150
        self.frame = parent
        self.display_sys = parent.display_sys
        self.persp_dict = self.display_sys.perspective_dict
        self.test_image = None
        self.help_bmp = wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_BUTTON, (20, 20))
        self.warn_large_img = GeneralSettingsData().warn_large_img

        sizer_main = wx.BoxSizer(wx.VERTICAL)

        # Master options
        sizer_top = wx.BoxSizer(wx.HORIZONTAL)
        self.cb_master = wx.CheckBox(self, -1, "Use perspective corrections")
        self.cb_master.SetValue(self.display_sys.use_perspective)
        # self.cb_master.Bind(wx.EVT_CHECKBOX, self.onCbmaster)
        self.button_help_persp = wx.BitmapButton(self, bitmap=self.help_bmp)
        self.button_help_persp.Bind(wx.EVT_BUTTON, self.onHelpPerspective)
        sizer_top.Add(self.cb_master, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
        sizer_top.AddStretchSpacer()
        sizer_top.Add(self.button_help_persp, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 10)

        # Profile options
        self.create_profile_opts()

        # Display perspective config
        self.create_display_opts(wpproc.NUM_DISPLAYS)

        # Bottom row buttons
        self.create_bottom_butts()

        # sizer_main.Add(self.cb_master, 0, wx.ALL|wx.ALIGN_LEFT, 5)
        sizer_main.Add(sizer_top, 0, wx.ALL|wx.EXPAND, 0)
        sizer_main.Add(self.sizer_prof_opts, 0, wx.ALL|wx.EXPAND, 5)
        sizer_main.Add(self.sizer_disp_opts, 0, wx.ALL|wx.EXPAND, 5)
        sizer_main.Add(self.sizer_buttons, 0, wx.ALL|wx.EXPAND, 5)
        self.SetSizer(sizer_main)
        self.Fit()
        if self.display_sys.default_perspective:
            self.populate_fields(self.display_sys.default_perspective)
            self.choice_profiles.SetSelection(
                self.choice_profiles.FindString(self.display_sys.default_perspective)
            )