Exemplo n.º 1
0
    def __initCtrl(self):
        """
        Initialize the controls.
        """
        # IDs
        [self.__editorID] = PyutUtils.assignID(1)

        sizer = BoxSizer(VERTICAL)

        self.__lblEditor = StaticText(self, -1, _("Editor"))
        self.__txtEditor = TextCtrl(self, -1, size=(100, 20))
        sizer.Add(self.__lblEditor, 0, ALL, DlgFastEditOptions.GAP)
        sizer.Add(self.__txtEditor, 0, ALL, DlgFastEditOptions.GAP)

        hs = BoxSizer(HORIZONTAL)
        btnOk = Button(self, ID_OK, _("&OK"))
        hs.Add(btnOk, 0, ALL, DlgFastEditOptions.GAP)
        sizer.Add(hs, 0, CENTER)

        self.SetAutoLayout(True)
        self.SetSizer(sizer)
        sizer.Fit(self)
        sizer.SetSizeHints(self)

        btnOk.SetDefault()

        self.Bind(EVT_TEXT, self.__OnText, id=self.__editorID)

        self.__setValues()
        self.Center()

        self.__changed: bool = False
Exemplo n.º 2
0
    def __init__(self,
                 parent,
                 headers,
                 buttons,
                 border=10,
                 edit_callback=None):
        super().__init__(parent)

        self._listbox = Table(self,
                              headers=[str(x.value) for x in headers],
                              callback=edit_callback)

        # CONTROL FRAMES
        button_frame = Panel(self)
        button_sizer = BoxSizer(HORIZONTAL)
        for callback, text in buttons:
            button_sizer.Add(SimpleButton(button_frame,
                                          text_button=text,
                                          callback=callback),
                             flag=TOP,
                             border=border)
        button_frame.SetSizer(button_sizer)
        # ALIGN
        sizer = BoxSizer(VERTICAL)
        sizer.Add(self._listbox, 1, EXPAND)
        sizer.Add(button_frame)
        self.SetSizer(sizer)
Exemplo n.º 3
0
    def __init__(self, parent, label, initial=""):
        super().__init__(parent)

        sizer = BoxSizer(HORIZONTAL)
        self._text_input = TextCtrl(self)
        self._text_input.SetValue(initial)
        sizer.Add(self._text_input)
        sizer.Add(StaticText(self, label=label))
        self.SetSizer(sizer)
Exemplo n.º 4
0
    def layout(self):
        vbox = BoxSizer(VERTICAL)

        vbox.Add(self.timer_display, 0, EXPAND)
        vbox.Add(self.contents_display, 1, EXPAND | LEFT, 10)
        vbox.Add(self.separeter_line, 0, TOP, 5)
        vbox.Add(self.add_button, 0, ALIGN_CENTER | TOP | BOTTOM, 5)
        self.panel.SetSizer(vbox)
        self.Show()
Exemplo n.º 5
0
    def build_details_default(self,sizer,row):

        Txt = lambda s: StaticText(self, -1, _(s))

        details = self.details

        add = lambda i, *a, **k: (sizer.Add(i, *a, **k),details.add(i))

        #                              position  span
        if hasattr(self, 'host'):
            add(Txt(_('Host:')),     (row, 0), flag = ALIGN_RIGHT|ALIGN_CENTER_VERTICAL|ALL, border = self.GetDefaultBorder())
            add(      self.host,     (row, 1), flag = EXPAND|ALL, border = self.host.GetDefaultBorder())
            add(Txt(_('Port:')),     (row, 2), flag = ALIGN_RIGHT|ALIGN_CENTER_VERTICAL|ALL, border = self.GetDefaultBorder())
            add(      self.port,     (row, 3), flag = EXPAND|ALL, border = self.port.GetDefaultBorder())
            row += 1

        if hasattr(self, 'resource'):
            add(Txt(_('Resource:')),   (row, 0), flag = ALIGN_RIGHT|ALIGN_CENTER_VERTICAL|ALL, border = self.GetDefaultBorder())
            add(      self.resource,   (row, 1), flag = EXPAND|ALL, border = self.resource.GetDefaultBorder())
            add(Txt(_('Priority:')),   (row, 2), flag = ALIGN_RIGHT|ALIGN_CENTER_VERTICAL|ALL, border = self.GetDefaultBorder())
            add(      self.priority,   (row, 3), flag = EXPAND|ALL, border = self.priority.GetDefaultBorder())
            row += 1

        if hasattr(self, 'dataproxy'):
            add(Txt(_('Data Proxy:')), (row, 0), flag = ALIGN_RIGHT|ALIGN_CENTER_VERTICAL|ALL, border = self.GetDefaultBorder())
            add(       self.dataproxy, (row, 1), (1, 3), flag = EXPAND|ALL, border = self.dataproxy.GetDefaultBorder())
            row += 1

        sub2 = BoxSizer(wx.HORIZONTAL)
        col1 = BoxSizer(wx.VERTICAL)
        col2 = BoxSizer(wx.VERTICAL)

#        add = lambda c,r,f,p,s: (details.add(c),s.Add(c,r,f,p))

        for d in getattr(self.protocolinfo, 'more_details', []):
            type_ = d['type']
            name  = d['store']
            if type_ == 'bool':
                ctrl = wx.CheckBox(self, -1, d['label'])
                setattr(self, name, ctrl)

                ctrl.SetValue(bool(getattr(self.account, name)))
                details.add(ctrl)
                col2.Add(ctrl, 0, ALL, ctrl.GetDefaultBorder())
            elif type_ == 'enum':
                ctrl = RadioPanel(self, d['elements'], details)
                setattr(self, name, ctrl)

                ctrl.SetValue(getattr(self.account, name))
                col1.Add(ctrl, 0, ALL, self.GetDefaultBorder())

        sub2.Add(col1,0,wx.RIGHT)
        sub2.Add(col2,0,wx.LEFT)

        self.Sizer.Add(sub2, 0, wx.ALIGN_CENTER_HORIZONTAL)
Exemplo n.º 6
0
    def layout(self):
        vbox = BoxSizer(VERTICAL)
        self.SetSizer(vbox)

        hbox = BoxSizer(HORIZONTAL)
        hbox.Add(self.time, 0, ALIGN_TOP | ALL, 5)
        hbox.Add(self.caption, 1, EXPAND | ALL | FIXED_MINSIZE, 5)
        hbox.Add(self.delete_button, 0, ALIGN_TOP | TOP | RIGHT, 5)

        vbox.Add(hbox, 1, EXPAND)
        vbox.Add(self.under_line, 0, ALL | ALIGN_CENTER, 3)
Exemplo n.º 7
0
    def __init__(self, lstClasses):

        super().__init__(None, ID_ANY, "Classes choice", style=CAPTION | RESIZE_BORDER, size=(400, 500))

        # Create not chosen classes listBox
        self._listBox1 = ListBox(self, ID_ANY, style=LB_EXTENDED | LB_ALWAYS_SB | LB_SORT, size=(320, 400))
        for klass in lstClasses:
            self._listBox1.Append(klass.__name__, klass)

        # Create chosen classes listBox
        self._listBox2 = ListBox(self, ID_ANY, style=LB_EXTENDED | LB_ALWAYS_SB | LB_SORT, size=(320, 400))

        # Create buttons
        btnOk = Button(self, ID_OK, "Ok")
        btnToTheRight = Button(self, ID_BTN_TO_THE_RIGHT, "=>")
        btnToTheLeft  = Button(self, ID_BTN_TO_THE_LEFT,  "<=")

        # Callbacks
        self.Bind(EVT_BUTTON, self._onBtnToTheRight, id=ID_BTN_TO_THE_RIGHT)
        self.Bind(EVT_BUTTON, self._onBtnToTheLeft,  id=ID_BTN_TO_THE_LEFT)

        # Create info label
        lblChoice = StaticText(self, ID_ANY, _("Choose classes to reverse: "))

        # Create buttons sizer
        szrBtn = BoxSizer(VERTICAL)
        szrBtn.Add(btnToTheRight, 0, EXPAND)
        szrBtn.Add(btnToTheLeft,  0, EXPAND)

        # Create lists and buttons sizer
        szrLB = BoxSizer(HORIZONTAL)
        szrLB.Add(self._listBox1,  0, EXPAND)
        szrLB.Add(szrBtn,          0, EXPAND)
        szrLB.Add(self._listBox2,  0, EXPAND)

        # Create sizer
        box = BoxSizer(VERTICAL)
        box.Add(lblChoice, 0, EXPAND)
        box.Add(szrLB,     0, EXPAND)
        box.Add(btnOk,     0, EXPAND)
        box.Fit(self)
        self.SetAutoLayout(True)
        self.SetSizer(box)

        # Show dialog
        self.ShowModal()
        if self.GetReturnCode() == ID_CANCEL:     # abort -> empty right column

            while self._listBox2.GetCount() > 0:
                data = self._listBox2.GetClientData(0)
                name = self._listBox2.GetString(0)
                self._listBox1.Append(name, data)
                self._listBox2.Delete(0)
Exemplo n.º 8
0
 def get_fields(self, page, vbox, field):
     for label in sorted(settings.SETTINGS[field.original].keys()):
         hbox = BoxSizer(HORIZONTAL)
         value = settings.SETTINGS[field.original][label]
         lbl = StaticText(page, label=label)
         hbox.Add(lbl, flag=RIGHT, border=8)
         subfield = Field(None, label)
         item = self.field_from_value(page, value, subfield)
         field.add_child(subfield)
         if item is not None:
             hbox.Add(item, proportion=1)
         vbox.Add(hbox, flag=EXPAND | LEFT | RIGHT | TOP, border=5)
         vbox.Add((-1, 5))
Exemplo n.º 9
0
    def __init__(self, parent, ID, title):
        """
        Constructor.

        @since 1.0
        @author C.Dutoit
        """
        # dialog box
        super().__init__(parent, ID, title, DefaultPosition, Size(720, 520))

        self.Center(BOTH)

        self.html = HtmlWindow(self, -1, DefaultPosition, Size(720, 520))

        htmlFileName = resource_filename(DlgHelp.HELP_PKG_NAME, 'index.html')
        self.html.LoadPage(htmlFileName)

        self.printer = HtmlEasyPrinting()

        self.box = BoxSizer(VERTICAL)
        self.box.Add(self.html, 1, GROW)
        subbox = BoxSizer(HORIZONTAL)

        btn = Button(self, ID_BACK, _("Back"))
        self.Bind(EVT_BUTTON, self.__OnBack, id=ID_BACK)
        subbox.Add(btn, 1, GROW | ALL, 2)

        btn = Button(self, ID_FORWARD, _("Forward"))
        self.Bind(EVT_BUTTON, self.__OnForward, id=ID_FORWARD)
        subbox.Add(btn, 1, GROW | ALL, 2)

        btn = Button(self, ID_PRINT, _("Print"))
        self.Bind(EVT_BUTTON, self.__OnPrint, id=ID_PRINT)
        subbox.Add(btn, 1, GROW | ALL, 2)

        btn = Button(self, ID_VIEW_SOURCE, _("View Source"))
        self.Bind(EVT_BUTTON, self.__OnViewSource, id=ID_VIEW_SOURCE)
        subbox.Add(btn, 1, GROW | ALL, 2)

        btn = Button(self, ID_OK, _("Exit"))
        subbox.Add(btn, 1, GROW | ALL, 2)

        self.box.Add(subbox, 0, GROW | BOTTOM)
        self.SetSizer(self.box)
        self.SetAutoLayout(True)
        subbox.Fit(self)
        self.box.Fit(self)

        self.OnShowDefault(None)

        self.Show(True)
Exemplo n.º 10
0
    def __init__(self, parent, editor_tab):
        Panel.__init__(self, parent)

        self.__editor_tab = editor_tab
        self.__cur_po_class = None

        sizer = GridBagSizer(5, 5)
        full_span = (1, 4)

        row = 0
        inner_sizer = BoxSizer(HORIZONTAL)
        self.btn_open_test_file = Button(self, label=u'Open test file')
        self.btn_open_test_file.Bind(EVT_BUTTON, self.__on_open_test_file)
        inner_sizer.Add(self.btn_open_test_file)

        self.btn_create_test_file = Button(self, label=u'Create test file')
        self.btn_create_test_file.Bind(EVT_BUTTON, self.__on_create_test_file)
        inner_sizer.Add(self.btn_create_test_file)

        self.btn_save_test_file = Button(self, label=u'Save current file')
        self.btn_save_test_file.Bind(EVT_BUTTON, self.__on_save_test_file)
        inner_sizer.Add(self.btn_save_test_file)

        inner_sizer.AddStretchSpacer(1)

        self.btn_create_test = Button(self,
                                      label=u'Create new method/test case')
        self.btn_create_test.Bind(EVT_BUTTON, self.__create_method_or_test)
        inner_sizer.Add(self.btn_create_test)
        sizer.Add(inner_sizer,
                  pos=(row, 0),
                  span=full_span,
                  flag=FLAG_ALL_AND_EXPAND)

        row += 1
        self.tabs = Tabs(self, [(Table, "Fields' table")])
        self.table = self.tabs.GetPage(0)
        self.table.Bind(EVT_GRID_SELECT_CELL, self.__on_cell_click)
        self.table.Bind(EVT_GRID_CELL_RIGHT_CLICK, self.__on_cell_click)

        sizer.Add(self.tabs,
                  pos=(row, 0),
                  span=full_span,
                  flag=FLAG_ALL_AND_EXPAND)

        sizer.AddGrowableCol(1, 1)
        sizer.AddGrowableRow(1, 1)
        self.SetSizer(sizer)
Exemplo n.º 11
0
class WizardPanel(Panel):
    def __init__(self, parent):
        Panel.__init__(self, parent=parent)
        self.panels = {}
        self.currentPanelKey = 0

        self.sizer = BoxSizer(VERTICAL)
        self.SetSizer(self.sizer)

    def AddPanel(self, newPanel, panelKey):
        panel = newPanel
        self.sizer.Add(panel, 1, EXPAND | ALL)
        self.panels[panelKey] = panel
        if (len(self.panels) > 1):
            panel.Hide()
            self.Layout()
        else:
            self.currentPanelKey = panelKey

    def SetActivePanel(self, panelKey):
        if panelKey in self.panels.keys():
            self.panels[self.currentPanelKey].Hide()
            self.panels[panelKey].Show()
            self.currentPanelKey = panelKey
            self.sizer.Layout()
Exemplo n.º 12
0
    def __init__(self, parent):
        FrmMain.FrmMain.__init__(self, parent)
        bsLocs = self.btnDestroy.GetContainingSizer()
        self.btnDestroy.Destroy()
        for loc in locations:
            loc_id = loc.replace(" ", "_")
            loc_box = BoxSizer()
            loc_box.SetOrientation(wx.VERTICAL)
            cbl_lbl = StaticText(self)
            cbl_lbl.Label = str(loc)
            cbl_lbl.SetName("col_{}".format(loc_id))
            cbl_lbl.Bind(wx.EVT_LEFT_UP, self.btnSelectLoc_Click)
            cbl_loc = CheckListBox(self)
            cbl_loc.SetName(loc_id)
            loc_box.Add(cbl_lbl, 0, wx.ALL, 5)
            loc_box.Add(cbl_loc, 0, wx.ALL, 5)
            bsLocs.Add(loc_box, 0, wx.ALL, 5)
        for p in printers:
            lid = p["Location"].replace(" ", "_")
            loc_list = self.FindWindowByName(lid, self)
            index = len(loc_list.Items) - 1
            if index < 0:
                index = 0

            loc_list.InsertItems([p["Path"]], index)
            # loc_list.SetString(index, p["Printer"])

        self.Layout()
        self.Fit()
        self.Show(True)
Exemplo n.º 13
0
    def build_details_social(self,sizer,row):
        types = ('alerts','feed', 'indicators')
        hsz = BoxSizer(wx.HORIZONTAL)


        d = self.details

        add = lambda c,s,*a: (d.add(c),s.Add(c,*a))

        for i, key in enumerate(types):
            checks = self.checks.get(key,())
            if not checks:
                continue

            sz = BoxSizer(wx.VERTICAL)
            tx = StaticText(self, -1, _('{show_topic}:').format(show_topic = self.protocolinfo['show_%s_label' % key]), style = wx.ALIGN_LEFT)
            from gui.textutil import CopyFont
            tx.Font = CopyFont(tx.Font, weight = wx.BOLD)

            add(tx, sz, 0, wx.BOTTOM, tx.GetDefaultBorder())
            for chk in checks:
                add(chk, sz, 0, ALL, chk.GetDefaultBorder())

            hsz.Add(sz,0)
#            if i != len(types)-1: hsz.AddSpacer(15)

        self.Sizer.Add(hsz,0,wx.BOTTOM | wx.LEFT,10)
        self.build_details_default(sizer, row)
Exemplo n.º 14
0
class ImportImagePanel(Panel):
    """
    Panel Principal para Importação de Imagem
    """
    def __init__(self, parent, imagePath):
        Panel.__init__(self, parent)

        self._hbox = BoxSizer(HORIZONTAL)
        self._grid_layout = FlexGridSizer(1, 2, 1, 1)

        # self._grid_layout = GridBagSizer(2, 1)

        self._configurationAndImportPanel = ConfigurationAndImportPanel(self)
        self._bitmapPanel = BitmapPanel(self, imagePath)

        self._grid_layout.AddMany([(self._configurationAndImportPanel, 1,
                                    LEFT), (self._bitmapPanel, 1, EXPAND)])

        self._grid_layout.AddGrowableCol(1, 1)
        self._grid_layout.AddGrowableRow(0, 1)

        self._hbox.Add(self._grid_layout,
                       proportion=1,
                       flag=ALL | EXPAND,
                       border=0)
        self.SetSizer(self._hbox)
Exemplo n.º 15
0
 def construct_notebook(self):
     """Constructs the main Notebook panel"""
     panel = Panel(self)
     self.notebook = Notebook(panel, style=NB_LEFT)
     self.construct_tabs()
     sizer = BoxSizer(HORIZONTAL)
     sizer.Add(self.notebook, 1, EXPAND)
     panel.SetSizer(sizer)
Exemplo n.º 16
0
 def __init__(self):
     self.loaded = False
     super().__init__(None)
     p = Panel(self)
     s = BoxSizer(VERTICAL)
     ts = BoxSizer(HORIZONTAL)
     ts.Add(StaticText(p, label='A&ddress'), 0, GROW)
     self.address = TextCtrl(p, style=TE_PROCESS_ENTER)
     self.address.Bind(EVT_TEXT_ENTER, self.on_enter)
     ts.Add(self.address, 1, GROW)
     s.Add(ts, 0, GROW)
     self.html = WebView.New(p)
     self.html.Bind(EVT_WEBVIEW_LOADED, self.on_load)
     self.html.Bind(EVT_WEBVIEW_ERROR, self.on_error)
     self.html.Bind(EVT_WEBVIEW_TITLE_CHANGED, self.on_title)
     s.Add(self.html, 1, GROW)
     p.SetSizerAndFit(s)
Exemplo n.º 17
0
 def __init__(self, message, *args, **kw):
     super().__init__(*args, **kw)
     hbox = BoxSizer()
     message = NormalText(self, label=message)
     hbox.Add(message, 0, ALL | ALIGN_CENTER, 20)
     self.SetSizer(hbox)
     self.Fit()
     self.Center()
     self.ShowModal()
Exemplo n.º 18
0
 def field_from_value(self, window, value, field):
     item = None
     if isinstance(value, six.string_types):
         item = TextCtrl(window, value=value)
         field.text_type = STRING_SETTING
     elif isinstance(value, list):
         if isinstance(value[0], six.string_types):
             item = TextCtrl(window, value=", ".join(value))
             field.text_type = STRING_LIST_SETTING
         elif isinstance(value[0], numbers.Real):
             item = TextCtrl(window,
                             value=", ".join((str(x) for x in value)))
             field.text_type = NUMBER_LIST_SETTING
     elif isinstance(value, bool):
         item = CheckBox(window, -1, '', (120, 75))
         item.SetValue(value)
     elif isinstance(value, numbers.Real):
         item = TextCtrl(window, value=str(value))
         field.text_type = NUMBER_SETTING
     elif isinstance(value, dict):
         subpage = Panel(window)
         vbox = BoxSizer(VERTICAL)
         for lbl in sorted(value.keys()):
             hbox = BoxSizer(HORIZONTAL)
             value2 = value[lbl]
             label = StaticText(subpage, label=lbl)
             hbox.Add(label, flag=RIGHT, border=8)
             subfield = Field(None, lbl)
             item = self.field_from_value(subpage, value2, subfield)
             field.add_child(subfield)
             if item is not None:
                 hbox.Add(item, proportion=1)
             vbox.Add(hbox, flag=EXPAND | LEFT | RIGHT | TOP, border=5)
             vbox.Add((-1, 5))
         subpage.SetSizer(vbox)
         subpage.Show()
         item = subpage
     else:
         # This is left for bug reporting purposes.
         printer.out(("{} from the field {} was not assigned to " +
                      "{} because type {} wasn't properly handled.").format(
                          value, field, window, type(value)))
     field.widget = item
     return item
Exemplo n.º 19
0
    def layout(self):
        self.Sizer = None

        #
        # overrides AnyRow.layout
        #
        sz = BoxSizer(HORIZONTAL)
        p = self.padding
        links = self.links
        rlinks = self.right_links
        blinks = self.bottom_links

        if self.image:
            sz.AddSpacer((p.x + self.image.Width + p.x, self.row_height))

        v = BoxSizer(VERTICAL)

        topH = BoxSizer(HORIZONTAL)
        topH.AddSpacer((1, self.Parent.fonts.filename.LineHeight), 0, EXPAND)
        topH.AddStretchSpacer(1)
        if rlinks:
            topH.Add(rlinks[0], 0, EXPAND | RIGHT | ALIGN_RIGHT, p.x)

        v.Add(topH, 0, EXPAND | TOP | BOTTOM, p.y)
        v.Add(self.pbar, 0, EXPAND | RIGHT, p.x)

        bottomH = BoxSizer(HORIZONTAL)
        Add = bottomH.Add
        Add(self.details, 0, EXPAND)
        if blinks:
            for link in blinks:
                Add(link, 0, EXPAND | RIGHT, p.x)

        bottomH.AddStretchSpacer(1)
        if rlinks:
            for link in rlinks[1:]:
                Add(link, 0, EXPAND | RIGHT, p.x)

        v.Add(bottomH, 0, EXPAND | TOP | BOTTOM, p.y)
        sz.Add(v, 1)

        # apply margins
        self.Sizer = self.margins.Sizer(sz)
Exemplo n.º 20
0
 def construct_docs_label(self, kind, value):
     """Constructs a documentation label"""
     sizer = BoxSizer(HORIZONTAL)
     label = HidableAutoWrapStaticText(
         parent=self.scrolled_panel,
         label=value,
         kind=kind,
     )
     sizer.Add(label, -1, EXPAND)
     self.grid_sizer.Add(sizer, -1, EXPAND)
Exemplo n.º 21
0
 def setup_v_box(
     self, h_box: wx.BoxSizer, h_button: wx.Button, pnl: wx.Panel
 ) -> None:
     h_box.Add(h_button, flag=wx.LEFT, border=5)
     self.v_box.Add(pnl, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
     self.v_box.Add(
         h_box, proportion=1, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=10
     )
     self.SetSizer(self.v_box)
     self.SetBackgroundColour(text_bg_col)
Exemplo n.º 22
0
    def __init__(self, parent, backupDir):
        super(Dialog, self).__init__(parent,
            style = DEFAULT_DIALOG_STYLE | RESIZE_BORDER
        )
        self.SetMinSize((300, 300))

        sizer = BoxSizer(HORIZONTAL)

        selector = GitSelector(self, backupDir, size = (700, 500))
        sizer.Add(selector, 1, EXPAND)

        scrollbar = ScrollBar(self, style = SB_VERTICAL)
        selector.scrollbar = scrollbar
        sizer.Add(scrollbar, 0, EXPAND)

        sizer.SetSizeHints(self)
        self.SetSizer(sizer)

        selector.Bind(EVT_COMMIT_SELECTED, self._on_commit_selected)
Exemplo n.º 23
0
 def construct_entry_label(self, value):
     """Creates the primary entry label"""
     sizer = BoxSizer(HORIZONTAL)
     label = StaticText(
         self.scrolled_panel,
         label=value,
         style=ALIGN_LEFT
     )
     label.SetFont(self.header_font)
     sizer.Add(label, -1, EXPAND)
     self.grid_sizer.Add(sizer, -1, EXPAND)
Exemplo n.º 24
0
    def __init__(self, *callbacks):
        Frame.__init__(self, None, ID_ANY, "CUT")
        self.Bind(EVT_CLOSE, lambda x: self.Destroy())
        root = Panel(self, EXPAND)
        sizer = BoxSizer(VERTICAL)

        elements = []
        for element in callbacks:
            sizer.Add(element, 1, EXPAND)

        root.SetSizer(sizer)
Exemplo n.º 25
0
    def __init__(self, parent):
        Panel.__init__(self, parent)

        startButon = Button(self, label="Start Photobox", size=((300, 100)))

        homeSizer = BoxSizer(VERTICAL)
        homeSizer.AddStretchSpacer()
        homeSizer.Add(startButon, 0, CENTER)
        homeSizer.AddStretchSpacer()

        self.SetSizer(homeSizer)
Exemplo n.º 26
0
 def field_from_value(self, window, value, field):
     item = None
     if isinstance(value, basestring):
         item = TextCtrl(window, value=value)
         field.text_type = STRING_SETTING
     elif isinstance(value, list):
         if isinstance(value[0], basestring):
             item = TextCtrl(window, value=", ".join(value))
             field.text_type = STRINGLIST_SETTING
         elif isinstance(value[0], int):
             item = TextCtrl(window,
                             value=", ".join((str(x) for x in value)))
             field.text_type = INTEGERLIST_SETTING
     elif isinstance(value, bool):
         item = CheckBox(window, -1, '', (120, 75))
         item.SetValue(value)
     elif isinstance(value, int):
         item = TextCtrl(window, value=str(value))
         field.text_type = INTEGER_SETTING
     elif isinstance(value, dict):
         subpage = Panel(window)
         vbox = BoxSizer(VERTICAL)
         alpha = value.keys()
         alpha.sort()
         for lbl in alpha:
             hbox = BoxSizer(HORIZONTAL)
             value2 = value[lbl]
             label = StaticText(subpage, label=lbl)
             hbox.Add(label, flag=RIGHT, border=8)
             subfield = Field(None, lbl)
             item = self.field_from_value(subpage, value2, subfield)
             field.add_child(subfield)
             if item is not None:
                 hbox.Add(item, proportion=1)
             vbox.Add(hbox, flag=EXPAND | LEFT | RIGHT | TOP, border=5)
             vbox.Add((-1, 5))
         subpage.SetSizer(vbox)
         subpage.Show()
         item = subpage
     field.wx_field = item
     return item
Exemplo n.º 27
0
    def __init__(self, dpi=(1, 1)):
        width = 300 * dpi[0]
        height = 80 * dpi[1]
        screenSize = DisplaySize()
        x = screenSize[0] - width - 10 * dpi[0],
        y = screenSize[1] - height - 100 * dpi[1]
        Frame.__init__(self,
                       parent=None,
                       id=ID_ANY,
                       pos=Point(x[0], y),
                       size=Size(width, height),
                       style=SIMPLE_BORDER | TRANSPARENT_WINDOW | STAY_ON_TOP
                       | FRAME_NO_TASKBAR,
                       name=EmptyString)

        bSizer4 = BoxSizer(VERTICAL)

        self.msgTitle = StaticText(self, ID_ANY, u"MyLabel", DefaultPosition,
                                   DefaultSize, 0)
        self.msgTitle.Wrap(-1)

        self.msgTitle.SetFont(
            Font(13, FONTFAMILY_DEFAULT, FONTSTYLE_NORMAL, FONTWEIGHT_BOLD,
                 False, EmptyString))

        bSizer4.Add(self.msgTitle, 0, ALL, 5)

        self.msgContent = StaticText(self, ID_ANY, u"MyLabel", DefaultPosition,
                                     DefaultSize, 0)
        self.msgContent.Wrap(-1)

        self.msgContent.SetFont(
            Font(12, FONTFAMILY_DEFAULT, FONTSTYLE_NORMAL, FONTWEIGHT_NORMAL,
                 False, EmptyString))

        bSizer4.Add(self.msgContent, 0, EXPAND, 5)

        self.SetSizer(bSizer4)
        self.Layout()
        # colorWhite = Colour(255, 255, 255)
        self.SetBackgroundColour(Colour(240, 240, 240))
Exemplo n.º 28
0
    def __init__(self, parent, title, text):
        Dialog.__init__(self, parent, title=title, style=CAPTION | STAY_ON_TOP)
        sizer = BoxSizer(VERTICAL)

        self.label = StaticText(self, label=text)
        sizer.Add(self.label, flag=FLAG_ALL_AND_EXPAND)

        self.gauge = Gauge(self, style=GA_SMOOTH | GA_HORIZONTAL)
        sizer.Add(self.gauge, flag=FLAG_ALL_AND_EXPAND)

        self.close_event = Event()

        def show_progress():
            while not self.close_event.is_set():
                sleep(0.05)
                self.gauge.Pulse()
            self.EndModal(ID_OK)

        self.SetSizerAndFit(sizer)

        run_in_separate_thread(show_progress)
Exemplo n.º 29
0
    def __init__(self, parent, title, text=None):
        Dialog.__init__(self,
                        parent,
                        title=title,
                        style=DEFAULT_DIALOG_STYLE | RESIZE_BORDER)
        self.SetTitle(title)
        self.SetSize(600, 400)

        sizer = BoxSizer(VERTICAL)

        self.txt_ctrl = TextCtrl(self,
                                 style=TE_MULTILINE | TE_READONLY | HSCROLL)
        if text:
            self.txt_ctrl.SetValue(text)
        sizer.Add(self.txt_ctrl, 1, flag=FLAG_ALL_AND_EXPAND)

        self.btn_ok = Button(self, label=u'OK')
        self.btn_ok.Bind(EVT_BUTTON, self.__close)
        sizer.Add(self.btn_ok, flag=CENTER)

        self.SetSizer(sizer)
Exemplo n.º 30
0
    def __init__(self, parent, file_path, load_file=False):
        Panel.__init__(self, parent)
        self.grandparent = self.GetGrandParent()

        self.__file_path = file_path

        sizer = BoxSizer(VERTICAL)
        self.txt_test_file_path = TextCtrl(self,
                                           value=self.__file_path,
                                           style=TE_READONLY)
        sizer.Add(self.txt_test_file_path, 0, flag=FLAG_ALL_AND_EXPAND)

        self.txt_content = TextCtrl(self, style=TE_MULTILINE | HSCROLL)
        self.txt_content.Bind(EVT_KEY_DOWN, self.__on_text_change)
        if load_file:
            self.txt_content.LoadFile(self.__file_path)
        font_size = self.txt_content.GetFont().GetPointSize()
        self.txt_content.SetFont(
            Font(font_size, FONTFAMILY_TELETYPE, NORMAL, NORMAL))
        sizer.Add(self.txt_content, 1, flag=FLAG_ALL_AND_EXPAND)

        self.SetSizer(sizer)