Python wx.ALIGN_RIGHT Examples

The following are 30 code examples of wx.ALIGN_RIGHT(). 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: settingsDialog.py    From Zulu with GNU Affero General Public License v3.0 6 votes vote down vote up
def __do_layout(self):
        # begin wxGlade: SerialDialog.__do_layout
        sizer_4 = wx.StaticBoxSizer(self.sizer_4_staticbox, wx.HORIZONTAL)
        grid_sizer_3 = wx.FlexGridSizer(7, 2, 2, 2)
        grid_sizer_3.Add(self.label_port, 0, wx.LEFT, 8)
        grid_sizer_3.Add(self.combo_box_port, 0, 0, 0)
        grid_sizer_3.Add(self.label_baudrate, 0, wx.LEFT, 8)
        grid_sizer_3.Add(self.combo_box_baudrate, 0, 0, 0)
        grid_sizer_3.Add(self.label_bytesize, 0, wx.LEFT, 8)
        grid_sizer_3.Add(self.combo_box_bytesize, 0, 0, 0)
        grid_sizer_3.Add(self.label_parity, 0, wx.LEFT, 8)
        grid_sizer_3.Add(self.combo_box_parity, 0, 0, 0)
        grid_sizer_3.Add(self.label_stopbits, 0, wx.LEFT, 8)
        grid_sizer_3.Add(self.combo_box_stopbits, 0, 0, 0)
        grid_sizer_3.Add(self.radio_box_rtscts, 0, wx.RIGHT|wx.TOP|wx.BOTTOM, 8)
        grid_sizer_3.Add(self.radio_box_xonxoff, 0, wx.LEFT|wx.TOP|wx.BOTTOM|wx.ALIGN_RIGHT, 8)
        grid_sizer_3.Add(self.button_cancel, 0, 0, 0)
        grid_sizer_3.Add(self.button_ok, 0, wx.ALIGN_RIGHT, 0)
        sizer_4.Add(grid_sizer_3, 1, wx.ALL|wx.EXPAND, 6)
        self.SetSizer(sizer_4)
        sizer_4.Fit(self)
        self.Layout()
        # end wxGlade 
Example #2
Source File: frame_downloader.py    From iqiyi-parser with MIT License 6 votes vote down vote up
def initTotal(self, total):
        self.total = total if total > 0 else 0
        self.gauge_total = wx.Gauge(self, wx.ID_ANY, 10000, wx.DefaultPosition, wx.DefaultSize,
                                       wx.GA_HORIZONTAL)
        self.gauge_total.SetValue(0)
        self.text_percent = wx.StaticText(self, wx.ID_ANY, '0%', wx.DefaultPosition,
                                          wx.Size(42, -1), wx.ALIGN_RIGHT)
        self.text_speed = wx.StaticText(self, wx.ID_ANY, '0B/s', wx.DefaultPosition, wx.Size(65, -1),
                                        wx.ALIGN_RIGHT)

        self.text_percent.Wrap(-1)
        self.text_speed.Wrap(-1)

        self.sizer_total.Add(self.text_percent, 0, wx.ALL, 5)
        self.sizer_total.Add(self.gauge_total, 5, wx.ALL | wx.EXPAND, 5)
        self.sizer_total.Add(self.text_speed, 0, wx.ALL, 5) 
Example #3
Source File: FindWindow.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent, hwnds):
        eg.Dialog.__init__(
            self,
            parent,
            title="Found Windows",
            size=(500, 350),
            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
        )
        windowList = eg.WindowList(self, hwnds)
        okButton = wx.Button(self, wx.ID_OK)
        btnSizer = eg.HBoxSizer(
            ((0, 0), 1, wx.EXPAND),
            (okButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND | wx.ALL, 5),
            ((0, 0), 1, wx.EXPAND),
            (eg.SizeGrip(self), 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT),
        )
        mainSizer = eg.VBoxSizer(
            (windowList, 1, wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, 5),
            (btnSizer, 0, wx.EXPAND),
        )
        self.SetSizer(mainSizer) 
Example #4
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def Configure(self,label="",cmdline=""):
        panel = eg.ConfigPanel(self)
        mainSizer =wx.BoxSizer(wx.VERTICAL)
        cmdlineLbl=wx.StaticText(panel, -1, self.text.cmdline)
        cmdlineCtrl=wx.TextCtrl(panel,-1,cmdline)
        cmdlineCtrl.SetMinSize((400,20))
        hlpbtnCtrl = wx.Button(panel, -1, self.text.help)
        def onBtnClick(event):
            self.plugin.OpenHelpPage('hlp_command_line.htm')
            event.Skip()
        hlpbtnCtrl.Bind(wx.EVT_BUTTON, onBtnClick, hlpbtnCtrl)
        labelLbl=wx.StaticText(panel, -1, self.text.label)
        labelCtrl=wx.TextCtrl(panel,-1,label)
        mainSizer.Add(cmdlineLbl,0,wx.TOP,20)
        mainSizer.Add(cmdlineCtrl,0,wx.EXPAND)
        mainSizer.Add(hlpbtnCtrl,0,wx.ALIGN_RIGHT|wx.TOP,8)
        mainSizer.Add(labelLbl,0,wx.ALIGN_RIGHT|wx.TOP,50)
        mainSizer.Add(labelCtrl,0,wx.ALIGN_RIGHT)
        panel.sizer.Add(mainSizer)
        while panel.Affirmed():
            panel.SetResult(labelCtrl.GetValue(),cmdlineCtrl.GetValue()) 
Example #5
Source File: optionsframe.py    From youtube-dl-gui with The Unlicense 6 votes vote down vote up
def _set_layout(self):
        main_sizer = wx.BoxSizer(wx.VERTICAL)

        main_sizer.Add(self.notebook, 1, wx.EXPAND | wx.ALL, border=5)
        main_sizer.Add(self.separator_line, 0, wx.EXPAND)

        buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
        buttons_sizer.Add(self.reset_button)
        buttons_sizer.AddSpacer((5, -1))
        buttons_sizer.Add(self.close_button)

        main_sizer.Add(buttons_sizer, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)

        self.panel.SetSizer(main_sizer)

        self.panel.Layout() 
Example #6
Source File: bug192.py    From wxGlade with MIT License 6 votes vote down vote up
def __do_layout(self):
        # begin wxGlade: Frame192.__do_layout
        self.sizer_as_attr = wx.FlexGridSizer(3, 1, 0, 0)
        sizer_local = wx.BoxSizer(wx.HORIZONTAL)
        label_1 = wx.StaticText(self, wx.ID_ANY, _("Just a text"), style=wx.ALIGN_CENTER)
        self.sizer_as_attr.Add(label_1, 1, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND | wx.SHAPED, 5)
        static_line_1 = wx.StaticLine(self, wx.ID_ANY)
        self.sizer_as_attr.Add(static_line_1, 0, wx.ALL | wx.EXPAND, 5)
        sizer_local.Add(self.button_2, 0, 0, 0)
        sizer_local.Add(self.button_1, 0, 0, 0)
        self.sizer_as_attr.Add(sizer_local, 1, wx.ALIGN_RIGHT | wx.ALL, 5)
        self.SetSizer(self.sizer_as_attr)
        self.sizer_as_attr.SetSizeHints(self)
        self.sizer_as_attr.AddGrowableRow(0)
        self.sizer_as_attr.AddGrowableCol(0)
        self.Layout()
        # end wxGlade

# end of class Frame192 
Example #7
Source File: ProjectDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, enable_required=True):
        wx.Dialog.__init__(self, parent, title=_('Project properties'),
                           style=wx.DEFAULT_DIALOG_STYLE)

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        self.ProjectProperties = ProjectPropertiesPanel(
            self, enable_required=enable_required, scrolling=False)
        main_sizer.AddWindow(self.ProjectProperties, flag=wx.GROW)

        self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        self.Bind(wx.EVT_BUTTON, self.OnOK,
                  self.ButtonSizer.GetAffirmativeButton())
        main_sizer.AddSizer(self.ButtonSizer, border=20,
                            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.SetSizer(main_sizer)
        self.ProjectProperties.Fit()
        self.Fit() 
Example #8
Source File: AboutDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, info):
        wx.Dialog.__init__(self, parent, title=_("License"), size=(500, 400),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        if parent and parent.GetIcon():
            self.SetIcon(parent.GetIcon())

        self.SetMinSize((400, 300))
        close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close"))

        ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE)
        ctrl.SetValue(info.License)

        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        btnSizer.Add(close)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(ctrl, 1, wx.EXPAND | wx.ALL, 10)
        sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10)
        self.SetSizer(sizer)
        self.Layout()
        self.Show()
        self.SetEscapeId(close.GetId())

        close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) 
Example #9
Source File: footer.py    From pyFileFixity with MIT License 6 votes vote down vote up
def _do_layout(self):
    self.stop_button.Hide()
    self.restart_button.Hide()

    v_sizer = wx.BoxSizer(wx.VERTICAL)
    h_sizer = wx.BoxSizer(wx.HORIZONTAL)

    h_sizer.AddStretchSpacer(1)
    h_sizer.Add(self.cancel_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)
    h_sizer.Add(self.start_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)

    v_sizer.AddStretchSpacer(1)
    v_sizer.Add(h_sizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
    v_sizer.Add(self.running_animation, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.RIGHT, 20)
    self.running_animation.Hide()

    h_sizer.Add(self.edit_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10)
    h_sizer.Add(self.restart_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10)
    h_sizer.Add(self.close_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)
    self.edit_button.Hide()
    self.restart_button.Hide()
    self.close_button.Hide()

    v_sizer.AddStretchSpacer(1)
    self.SetSizer(v_sizer) 
Example #10
Source File: guiminer.py    From poclbm with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, title):
        style = wx.DEFAULT_DIALOG_STYLE
        vbox = wx.BoxSizer(wx.VERTICAL)
        wx.Dialog.__init__(self, parent, -1, title, style=style)
        self.user_lbl = wx.StaticText(self, -1, STR_USERNAME)
        self.txt_username = wx.TextCtrl(self, -1, "")
        self.pass_lbl = wx.StaticText(self, -1, STR_PASSWORD)
        self.txt_pass = wx.TextCtrl(self, -1, "", style=wx.TE_PASSWORD)
        grid_sizer_1 = wx.FlexGridSizer(2, 2, 5, 5)
        grid_sizer_1.Add(self.user_lbl, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_1.Add(self.txt_username, 0, wx.EXPAND, 0)
        grid_sizer_1.Add(self.pass_lbl, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_1.Add(self.txt_pass, 0, wx.EXPAND, 0)
        buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL)
        vbox.Add(grid_sizer_1, wx.EXPAND | wx.ALL, 10)
        vbox.Add(buttons)
        self.SetSizerAndFit(vbox) 
Example #11
Source File: misc.py    From trelby with GNU General Public License v2.0 6 votes vote down vote up
def addCombo(self, name, descr, parent, sizer, items, sel):
        al = wx.ALIGN_CENTER_VERTICAL | wx.RIGHT
        if sel == 1:
            al |= wx.ALIGN_RIGHT

        sizer.Add(wx.StaticText(parent, -1, descr), 0, al, 10)

        combo = wx.ComboBox(parent, -1, style = wx.CB_READONLY)
        util.setWH(combo, w = 200)

        for s in items:
            combo.Append(s)

        combo.SetSelection(sel)

        sizer.Add(combo)

        setattr(self, name + "Combo", combo) 
Example #12
Source File: CustomTree.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def GetBitmapRect(self):
        client_size = self.GetClientSize()
        bitmap_size = self.BackgroundBitmap.GetSize()

        if self.BackgroundAlign & wx.ALIGN_RIGHT:
            x = client_size[0] - bitmap_size[0]
        elif self.BackgroundAlign & wx.ALIGN_CENTER_HORIZONTAL:
            x = (client_size[0] - bitmap_size[0]) // 2
        else:
            x = 0

        if self.BackgroundAlign & wx.ALIGN_BOTTOM:
            y = client_size[1] - bitmap_size[1]
        elif self.BackgroundAlign & wx.ALIGN_CENTER_VERTICAL:
            y = (client_size[1] - bitmap_size[1]) // 2
        else:
            y = 0

        return wx.Rect(x, y, bitmap_size[0], bitmap_size[1]) 
Example #13
Source File: ComplexExample_30_Phoenix.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrameGrid.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((492, 300))
        self.SetTitle(_("FrameOggCompressionDetails"))

        self._szr_frame = wx.BoxSizer(wx.VERTICAL)

        self.grid_sizer = wx.FlexGridSizer(3, 1, 0, 0)
        self._szr_frame.Add(self.grid_sizer, 1, wx.EXPAND, 0)

        self.grid = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1))
        self.grid.CreateGrid(8, 3)
        self.grid_sizer.Add(self.grid, 1, wx.EXPAND, 0)

        self.static_line = wx.StaticLine(self, wx.ID_ANY)
        self.grid_sizer.Add(self.static_line, 0, wx.ALL | wx.EXPAND, 5)

        self.button = wx.Button(self, wx.ID_CLOSE, "")
        self.button.SetFocus()
        self.button.SetDefault()
        self.grid_sizer.Add(self.button, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.grid_sizer.AddGrowableRow(0)
        self.grid_sizer.AddGrowableCol(0)

        self.SetSizer(self._szr_frame)
        self._szr_frame.SetSizeHints(self)

        self.Layout()
        # end wxGlade

# end of class MyFrameGrid 
Example #14
Source File: ForceVariableDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, iec_type, defaultValue=""):
        """
        Constructor
        @param parent: Parent wx.Window of dialog for modal
        @param iec_type: IEC type of variable (string). For example 'BOOL', 'LREAL'.
        @param defaultValue: current variable value as string. Default is empty string.
        """
        wx.Dialog.__init__(
            self, parent,
            name='ForceVariableDialog',
            title=_("Please enter value for a \"%s\" variable:") % iec_type,
            style=wx.DEFAULT_DIALOG_STYLE, pos=wx.DefaultPosition)

        self.IEC_Type = iec_type
        info_sizer = wx.BoxSizer(wx.VERTICAL)

        message_label = wx.StaticText(self, label=_("Forcing Variable Value"))
        info_sizer.AddWindow(message_label, border=10,
                             flag=wx.ALIGN_LEFT | wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)

        if GetTypeValue[self.IEC_Type] in [getinteger, getfloat]:
            self.InitCtrlNumber(info_sizer, defaultValue)
        elif self.IEC_Type == "BOOL":
            self.InitCtrlBool(info_sizer, defaultValue)
        else:
            self.InitCtrlDefault(info_sizer, defaultValue)
        self.GetEnteredValue = self.GetValueDefault

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
        info_sizer.AddSizer(button_sizer, border=10, flag=wx.ALIGN_RIGHT | wx.ALL)

        self.SetSizer(info_sizer)
        self.Fit()
        self.ValueCtrl.SetFocus()

    # ---------------------------------
    # default type methods
    # --------------------------------- 
Example #15
Source File: IDMergeDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, title, question, optiontext, button_texts):
        wx.Dialog.__init__(self, parent, title=title)

        main_sizer = wx.BoxSizer(wx.VERTICAL)

        message = wx.StaticText(self, label=question)
        main_sizer.AddWindow(message, border=20,
                             flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.LEFT | wx.RIGHT)

        self.check = wx.CheckBox(self, label=optiontext)
        main_sizer.AddWindow(self.check, border=20,
                             flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)

        buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
        for label, wxID in zip(button_texts, [wx.ID_YES, wx.ID_NO, wx.ID_CANCEL]):
            Button = wx.Button(self, label=label)

            def OnButtonFactory(_wxID):
                return lambda event: self.EndModal(_wxID)

            self.Bind(wx.EVT_BUTTON, OnButtonFactory(wxID), Button)
            buttons_sizer.AddWindow(Button)

        main_sizer.AddSizer(buttons_sizer, border=20,
                            flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_RIGHT)

        self.SetSizer(main_sizer)
        self.Fit()

        self.Bind(wx.EVT_CHAR_HOOK, self.OnEscapeKey) 
Example #16
Source File: OLVPrinter.py    From bookhub with MIT License 5 votes vote down vote up
def Normal(fontName="Arial"):
        """
        Return a reasonable default format for a report
        """
        fmt = ReportFormat()
        fmt.PageHeader.Font = wx.FFont(24, wx.FONTFAMILY_DEFAULT, face=fontName)
        fmt.PageHeader.TextAlignment = wx.ALIGN_CENTRE
        fmt.PageHeader.Add(FrameDecoration(pen=wx.Pen(wx.BLUE, 1), space=5))
        #fmt.PageHeader.Add(LineDecoration(pen=wx.Pen(wx.BLUE, 2), space=5))

        fmt.ReportHeader.Font = wx.FFont(36, wx.FONTFAMILY_DEFAULT, face=fontName)
        fmt.ReportHeader.TextColor = wx.RED
        fmt.ReportHeader.Padding = (0, 12, 0, 12)

        fmt.ListHeader.Add(LineDecoration(side=Decoration.BOTTOM, pen=wx.Pen(wx.GREEN, 1)))

        fmt.PageFooter.Font = wx.FFont(12, wx.FONTFAMILY_DEFAULT, face=fontName)
        fmt.PageFooter.TextAlignment = wx.ALIGN_RIGHT
        fmt.PageFooter.Add(LineDecoration(side=Decoration.TOP, pen=wx.Pen(wx.BLUE, 1), space=3))

        fmt.Row.Font = wx.FFont(12, wx.FONTFAMILY_DEFAULT, face=fontName)
        #fmt.ColumnHeader.CellPadding=25
        fmt.ColumnHeader.GridPen=wx.Pen(wx.RED, 1)
        fmt.Row.CellPadding=(10, 10, 0, 10)
        fmt.Row.GridPen=wx.Pen(wx.BLUE, 1)
        #fmt.ColumnHeader.Add(FrameDecoration(pen=wx.Pen(wx.RED, 1)))
        #fmt.Row.Add(FrameDecoration(pen=wx.Pen(wx.RED, 10)))
        #fmt.Row.Add(LineDecoration(side=Decoration.BOTTOM, pen=wx.Pen(wx.GREEN, 1)))

        return fmt

#====================================================================== 
Example #17
Source File: OLVPrinter.py    From bookhub with MIT License 5 votes vote down vote up
def GetColumnAlignments(self, olv, left, right):
        """
        Return the alignments of the given slice of columns
        """
        listAlignments = [olv.GetColumn(i).GetAlign() for i in range(left, right+1)]
        mapping = {
            wx.LIST_FORMAT_LEFT: wx.ALIGN_LEFT,
            wx.LIST_FORMAT_RIGHT: wx.ALIGN_RIGHT,
            wx.LIST_FORMAT_CENTRE: wx.ALIGN_CENTRE,
        }
        return [mapping[x] for x in listAlignments] 
Example #18
Source File: ListCtrlPrinter.py    From bookhub with MIT License 5 votes vote down vote up
def GetAlignments(self):
        """
        Return a list indicating how the text within each cell is aligned.
        """
        return (wx.ALIGN_LEFT, wx.ALIGN_CENTER_HORIZONTAL, wx.ALIGN_RIGHT)

#---------------------------------------------------------------------------- 
Example #19
Source File: ListCtrlPrinter.py    From bookhub with MIT License 5 votes vote down vote up
def GetColumnAlignments(self, lv, left, right):
        """
        Return the alignments of the given slice of columns
        """
        listAlignments = [lv.GetColumn(i).GetAlign() for i in range(left, right+1)]
        mapping = {
            wx.LIST_FORMAT_LEFT: wx.ALIGN_LEFT,
            wx.LIST_FORMAT_RIGHT: wx.ALIGN_RIGHT,
            wx.LIST_FORMAT_CENTRE: wx.ALIGN_CENTRE,
        }
        return [mapping[x] for x in listAlignments]



#---------------------------------------------------------------------------- 
Example #20
Source File: BrowseValuesLibraryDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, name, library, default=None):
        wx.Dialog.__init__(self,
                           name='BrowseValueDialog', parent=parent,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                           title=_('Browse %s values library') % name)

        self.staticText1 = wx.StaticText(
            label=_('Choose a value for %s:') % name,
            name='staticText1', parent=self,
            pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)

        self.ValuesLibrary = wx.TreeCtrl(
            name='ValuesLibrary', parent=self, pos=wx.Point(0, 0),
            size=wx.Size(400, 200),
            style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT)

        self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)

        self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())

        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)

        self.flexGridSizer1.AddWindow(self.staticText1,   0, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
        self.flexGridSizer1.AddWindow(self.ValuesLibrary, 0, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT)
        self.flexGridSizer1.AddSizer(self.ButtonSizer,    0, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.flexGridSizer1.AddGrowableCol(0)
        self.flexGridSizer1.AddGrowableRow(1)

        self.SetSizer(self.flexGridSizer1)
        self.Fit()

        root = self.ValuesLibrary.AddRoot("")
        self.GenerateValuesLibraryBranch(root, library, default) 
Example #21
Source File: msgdialog.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MessageDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        wx.Dialog.__init__(self, *args, **kwds)
        bmp = compat.wx_ArtProvider_GetBitmap(wx.ART_TIP, wx.ART_MESSAGE_BOX, (48, 48))
        self.msg_image = wx.StaticBitmap(self, wx.ID_ANY, bmp)
        self.msg_list = wx.ListCtrl(self, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_NO_HEADER | wx.LC_REPORT | wx.LC_SINGLE_SEL)
        self.OK = wx.Button(self, wx.ID_OK, "")
        # properties
        self.SetTitle(_("wxGlade Message"))
        self.msg_image.SetMinSize((48, 48))
        self.OK.SetFocus()
        self.OK.SetDefault()
        # layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        msg_title = wx.StaticText(self, wx.ID_ANY, _("wxGlade Message"))
        msg_title.SetFont(wx.Font(-1, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        sizer_1.Add(msg_title, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5)
        sizer_2.Add(self.msg_image, 0, 0, 0)
        sizer_2.Add(self.msg_list, 1, wx.EXPAND | wx.LEFT, 10)
        sizer_1.Add(sizer_2, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
        sizer_1.Add(self.OK, 0, wx.ALIGN_RIGHT | wx.ALL, 10)
        self.SetSizer(sizer_1)
        self.Layout()
        self.Centre() 
Example #22
Source File: item_sizer.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def initWidget(self, **kwargs):

        name = kwargs.get('name', '')
        current = kwargs.get('current', 0)
        percent = current*100.0 / self.total if self.total > 0 else 0
        speed = format_byte(kwargs.get('speed', 0), '%.1f%s/S')

        self.text_name = wx.StaticText(self.parent, wx.ID_ANY, name, wx.DefaultPosition, wx.Size(20, -1),
                                       wx.ALIGN_RIGHT)
        self.text_percent = wx.StaticText(self.parent, wx.ID_ANY, str(round(percent, 1)) + '%', wx.DefaultPosition,
                                          wx.Size(40, -1), wx.ALIGN_RIGHT)
        self.text_speed = wx.StaticText(self.parent, wx.ID_ANY, speed, wx.DefaultPosition, wx.Size(65, -1),
                                        wx.ALIGN_RIGHT)

        self.text_name.Wrap(-1)
        self.text_percent.Wrap(-1)
        self.text_speed.Wrap(-1)

        self.gauge_progress = wx.Gauge(self.parent, wx.ID_ANY, 10000, wx.DefaultPosition, wx.DefaultSize,
                                       wx.GA_HORIZONTAL)
        self.gauge_progress.SetValue(int(percent*100))

        self.Add(self.text_name, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
        self.Add(self.gauge_progress, 5, wx.ALL, 5)
        self.Add(self.text_percent, 0, wx.ALL, 5)
        self.Add(self.text_speed, 0, wx.ALL, 5)
        # self.Add(self.text_progress, 0, wx.ALL, 5)
        staticline1 = wx.StaticLine(self.parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)

        self.Add(staticline1, 0, wx.EXPAND | wx.ALL, 2) 
Example #23
Source File: dialog_gettool.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def __init__(self, parent, title, total_byte, dlm):
        wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=title, pos=wx.DefaultPosition, size=wx.DefaultSize,
                           style=wx.DEFAULT_DIALOG_STYLE)
        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        self.global_sizer = wx.BoxSizer(wx.VERTICAL)

        self.gauge_progress = wx.Gauge(self, wx.ID_ANY, 10000, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL)
        self.gauge_progress.SetValue(524)
        self.global_sizer.Add(self.gauge_progress, 0, wx.ALL | wx.EXPAND, 5)

        sizer_info = wx.BoxSizer(wx.HORIZONTAL)

        self.text_percent = wx.StaticText(self, wx.ID_ANY, u"0.0%", wx.DefaultPosition, wx.DefaultSize,
                                            wx.ALIGN_LEFT)
        self.text_percent.Wrap(-1)

        sizer_info.Add(self.text_percent, 1, wx.ALL, 5)

        self.total_byte = total_byte
        self.format_int = '%0' + str(len(str(self.total_byte))) + 'd/%0' + str(len(str(self.total_byte))) + 'd'

        self.text_progress = wx.StaticText(self, wx.ID_ANY, self.format_int % (0, self.total_byte), wx.DefaultPosition, wx.DefaultSize,
                                            wx.ALIGN_RIGHT)
        self.text_progress.Wrap(-1)

        sizer_info.Add(self.text_progress, 1, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.global_sizer.Add(sizer_info, 1, wx.EXPAND, 5)

        self.SetSizer(self.global_sizer)
        self.Layout()
        self.global_sizer.Fit(self)

        self.Centre(wx.BOTH)
        self.Bind(wx.EVT_CLOSE, self.onClose)

        self.timer = wx.Timer()

        self.timer.SetOwner(self, wx.ID_ANY)
        self.dlm = dlm 
Example #24
Source File: templates_ui.py    From wxGlade with MIT License 5 votes vote down vote up
def __do_layout(self):
        # begin wxGlade: TemplateInfoDialog.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_5 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Instructions")), wx.HORIZONTAL)
        sizer_4 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Description")), wx.HORIZONTAL)
        sizer_3 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Author")), wx.HORIZONTAL)
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        label_template_name = wx.StaticText(self, wx.ID_ANY, _("wxGlade template: "))
        label_template_name.SetFont(wx.Font(-1, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        sizer_2.Add(label_template_name, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 10)
        sizer_2.Add(self.template_name, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 10)
        sizer_1.Add(sizer_2, 0, wx.EXPAND, 0)
        sizer_3.Add(self.author, 1, 0, 0)
        sizer_1.Add(sizer_3, 0, wx.ALL | wx.EXPAND, 5)
        sizer_4.Add(self.description, 1, wx.EXPAND, 0)
        sizer_1.Add(sizer_4, 1, wx.ALL | wx.EXPAND, 5)
        sizer_5.Add(self.instructions, 1, wx.EXPAND, 0)
        sizer_1.Add(sizer_5, 1, wx.ALL | wx.EXPAND, 5)
        sizer_6.Add(self.button_1, 0, 0, 0)
        sizer_6.Add(self.button_2, 0, wx.LEFT, 10)
        sizer_1.Add(sizer_6, 0, wx.ALIGN_RIGHT | wx.ALL, 10)
        self.SetSizer(sizer_1)
        self.Layout()
        self.Centre()
        # end wxGlade

# end of class TemplateInfoDialog 
Example #25
Source File: bugdialog_ui.py    From wxGlade with MIT License 5 votes vote down vote up
def __do_layout(self):
        # begin wxGlade: UIBugDialog.__do_layout
        grid_sizer_1 = wx.FlexGridSizer(3, 1, 0, 0)
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
        grid_sizer_2 = wx.FlexGridSizer(2, 1, 0, 0)
        sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
        grid_sizer_3 = wx.FlexGridSizer(3, 1, 0, 0)
        grid_sizer_3.Add(self.st_header, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_3.Add(self.st_summary, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_3.Add(self.st_report, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_3.AddGrowableCol(0)
        sizer_1.Add(grid_sizer_3, 1, wx.EXPAND, 0)
        self.nb1_pane_summary.SetSizer(sizer_1)
        grid_sizer_2.Add(self.st_details, 0, wx.ALL | wx.EXPAND, 5)
        grid_sizer_2.Add(self.tc_details, 1, wx.ALL | wx.EXPAND, 5)
        self.nb1_pane_details.SetSizer(grid_sizer_2)
        grid_sizer_2.AddGrowableRow(1)
        grid_sizer_2.AddGrowableCol(0)
        sizer_3.Add(self.tc_howto_report, 1, wx.ALL | wx.EXPAND, 5)
        self.notebook_1_pane_1.SetSizer(sizer_3)
        self.notebook_1.AddPage(self.nb1_pane_summary, _("Error Summary"))
        self.notebook_1.AddPage(self.nb1_pane_details, _("Error Details"))
        self.notebook_1.AddPage(self.notebook_1_pane_1, _("How to Report a Bug"))
        grid_sizer_1.Add(self.notebook_1, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_1.Add(self.static_line_1, 0, wx.ALL | wx.EXPAND, 5)
        sizer_2.Add(self.btn_copy, 0, wx.ALL, 5)
        sizer_2.Add(self.btn_ok, 0, wx.ALL, 5)
        grid_sizer_1.Add(sizer_2, 1, wx.ALIGN_RIGHT, 0)
        self.SetSizer(grid_sizer_1)
        grid_sizer_1.AddGrowableRow(0)
        grid_sizer_1.AddGrowableCol(0)
        self.Layout()
        self.Centre()
        # end wxGlade 
Example #26
Source File: ComplexExample_Phoenix.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrameGrid.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((492, 300))
        self.SetTitle(_("FrameOggCompressionDetails"))

        self._szr_frame = wx.BoxSizer(wx.VERTICAL)

        self.grid_sizer = wx.FlexGridSizer(3, 1, 0, 0)
        self._szr_frame.Add(self.grid_sizer, 1, wx.EXPAND, 0)

        self.grid = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1))
        self.grid.CreateGrid(8, 3)
        self.grid_sizer.Add(self.grid, 1, wx.EXPAND, 0)

        self.static_line = wx.StaticLine(self, wx.ID_ANY)
        self.grid_sizer.Add(self.static_line, 0, wx.ALL | wx.EXPAND, 5)

        self.button = wx.Button(self, wx.ID_CLOSE, "")
        self.button.SetFocus()
        self.button.SetDefault()
        self.grid_sizer.Add(self.button, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.grid_sizer.AddGrowableRow(0)
        self.grid_sizer.AddGrowableCol(0)

        self.SetSizer(self._szr_frame)
        self._szr_frame.SetSizeHints(self)

        self.Layout()
        # end wxGlade

# end of class MyFrameGrid 
Example #27
Source File: PyOgg3.py    From wxGlade with MIT License 5 votes vote down vote up
def __do_layout(self):
        # begin wxGlade: PyOgg3_MyFrame.__do_layout
        sizer_5 = wx.BoxSizer(wx.VERTICAL)
        grid_sizer_3 = wx.FlexGridSizer(3, 1, 0, 0)
        grid_sizer_3.Add(self.grid_1, 1, wx.EXPAND, 0)
        grid_sizer_3.Add(self.static_line_2, 0, wx.ALL | wx.EXPAND, 5)
        grid_sizer_3.Add(self.button_6, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
        grid_sizer_3.AddGrowableRow(0)
        grid_sizer_3.AddGrowableCol(0)
        sizer_5.Add(grid_sizer_3, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_5)
        self.Layout()
        # end wxGlade

# end of class PyOgg3_MyFrame 
Example #28
Source File: templates_ui.py    From wxGlade with MIT License 5 votes vote down vote up
def __do_layout(self):
        # begin wxGlade: TemplateListDialog.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_8 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_4 = wx.BoxSizer(wx.VERTICAL)
        sizer_7 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Instructions")), wx.HORIZONTAL)
        sizer_6 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Description")), wx.HORIZONTAL)
        sizer_5 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Author")), wx.HORIZONTAL)
        sizer_3 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Available templates")), wx.VERTICAL)
        sizer_3.Add(self.template_names, 1, wx.ALL | wx.EXPAND, 3)
        sizer_2.Add(sizer_3, 1, wx.ALL | wx.EXPAND, 5)
        sizer_4.Add(self.template_name, 0, wx.ALL, 7)
        sizer_5.Add(self.author, 1, 0, 0)
        sizer_4.Add(sizer_5, 0, wx.ALL | wx.EXPAND, 5)
        sizer_6.Add(self.description, 1, wx.EXPAND, 0)
        sizer_4.Add(sizer_6, 1, wx.ALL | wx.EXPAND, 5)
        sizer_7.Add(self.instructions, 1, wx.EXPAND, 0)
        sizer_4.Add(sizer_7, 1, wx.ALL | wx.EXPAND, 5)
        sizer_2.Add(sizer_4, 2, wx.EXPAND, 0)
        sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
        sizer_8.Add(self.btn_open, 0, 0, 0)
        sizer_8.Add(self.btn_edit, 0, wx.LEFT, 10)
        sizer_8.Add(self.btn_delete, 0, wx.LEFT, 10)
        sizer_8.Add(self.btn_cancel, 0, wx.LEFT, 10)
        sizer_1.Add(sizer_8, 0, wx.ALIGN_RIGHT | wx.ALL, 10)
        self.SetSizer(sizer_1)
        self.Layout()
        self.Centre()
        # end wxGlade 
Example #29
Source File: ComplexExample.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrameGrid.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((492, 300))
        self.SetTitle(_("FrameOggCompressionDetails"))

        self._szr_frame = wx.BoxSizer(wx.VERTICAL)

        self.grid_sizer = wx.FlexGridSizer(3, 1, 0, 0)
        self._szr_frame.Add(self.grid_sizer, 1, wx.EXPAND, 0)

        self.grid = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1))
        self.grid.CreateGrid(8, 3)
        self.grid_sizer.Add(self.grid, 1, wx.EXPAND, 0)

        self.static_line = wx.StaticLine(self, wx.ID_ANY)
        self.grid_sizer.Add(self.static_line, 0, wx.ALL | wx.EXPAND, 5)

        self.button = wx.Button(self, wx.ID_CLOSE, "")
        self.button.SetFocus()
        self.button.SetDefault()
        self.grid_sizer.Add(self.button, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.grid_sizer.AddGrowableRow(0)
        self.grid_sizer.AddGrowableCol(0)

        self.SetSizer(self._szr_frame)
        self._szr_frame.SetSizeHints(self)

        self.Layout()
        # end wxGlade

# end of class MyFrameGrid 
Example #30
Source File: navigation_toolbar.py    From RF-Monitor with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, canvas, legend):
        NavigationToolbar2Wx.__init__(self, canvas)
        self._canvas = canvas
        self._legend = legend
        self._autoScale = True

        if matplotlib.__version__ >= '1.2':
            panId = self.wx_ids['Pan']
        else:
            panId = self.FindById(self._NTB2_PAN).GetId()
        self.ToggleTool(panId, True)
        self.pan()

        checkLegend = wx.CheckBox(self, label='Legend')
        checkLegend.SetValue(legend.get_visible())
        self.AddControl(checkLegend)
        self.Bind(wx.EVT_CHECKBOX, self.__on_legend, checkLegend, id)

        if wx.__version__ >= '2.9.1':
            self.AddStretchableSpace()
        else:
            self.AddSeparator()

        self._textCursor = wx.StaticText(self, style=wx.ALL | wx.ALIGN_RIGHT)
        font = self._textCursor.GetFont()
        if wx.__version__ >= '2.9.1':
            font.MakeSmaller()
        font.SetFamily(wx.FONTFAMILY_TELETYPE)
        self._textCursor.SetFont(font)
        w, _h = get_text_size(' ' * 18, font)
        self._textCursor.SetSize((w, -1))

        self.AddControl(self._textCursor)

        self.Realize()