Exemple #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
Exemple #2
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)
Exemple #3
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)
Exemple #4
0
    def init_components(self):
        self.old_pw_label = wx.StaticText(self, label=_("Old Password: "******"New Password: "******"Confirm New Password: "))
        self.new2_pw_text = wx.TextCtrl(self,
                                        style=wx.TE_PASSWORD,
                                        validator=LengthLimit(1024))

        self.ok_btn = wx.Button(self, wx.ID_OK)
        self.ok_btn.Enable(False)
        self.ok_btn.SetDefault()
        self.cancel_btn = wx.Button(self, wx.ID_CANCEL)

        self.old_sizer = BoxSizer(HORIZONTAL)
        self.new1_sizer = BoxSizer(HORIZONTAL)
        self.new2_sizer = BoxSizer(HORIZONTAL)

        self.btn_sizer = build_button_sizer(self.ok_btn, self.cancel_btn, 2)

        self.main_sizer = BoxSizer(VERTICAL)

        self.Sizer = BoxSizer(HORIZONTAL)
Exemple #5
0
    def __init__(self,
                 parent,
                 content=None,
                 title='',
                 buttonlabel='',
                 buttoncb=None,
                 titlemaker=None,
                 prefix=''):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        sizer = self.Sizer = BoxSizer(VERTICAL)
        self.headersizer = BoxSizer(HORIZONTAL)
        self.bodysizer = BoxSizer(VERTICAL)
        sizer.Add(self.headersizer, 0, EXPAND | TOP, space_over_header)
        sizer.Add(self.bodysizer, 1, EXPAND | TOP, space_under_header)

        self.title = None
        self.combo = None
        self.button = None
        self.content = None
        self.contents = {}
        self.titlemaker = titlemaker
        if wxMac:
            self.menuitems = {}

        if title and isinstance(title, basestring):
            self.title = wx.StaticText(self,
                                       -1,
                                       ' ' + title + ' ',
                                       style=wx.ALIGN_CENTER_VERTICAL)

            #need grey backgound behind label on mac to hide the line
            if wxMac:
                self.title.BackgroundColour = wx.Color(232, 232, 232)
            self.title.Font = self.HeaderFont
            self.headersizer.Add(self.title, 0, *header_sizer_flags)

        if callable(content):
            content = self.content = content(self, prefix)
            self.bodysizer.Add(self.content, 1, pref_sizer_style, 7)
        elif isinstance(content, wx.WindowClass):
            content.Reparent(self)
            self.content = content
            self.bodysizer.Add(self.content, 1, pref_sizer_style, 7)
        elif isinstance(content, list):
            self.SetContents(content)

        if buttoncb:
            self.SetButton(buttonlabel, buttoncb)

        Bind = self.Bind
        Bind(wx.EVT_PAINT, self.OnPaint)

        #darker border if mac so it is visible for now
        if not wxMac:
            self.pen = wx.Pen(wx.Colour(213, 213, 213))
        else:
            self.pen = wx.Pen(wx.Colour(155, 155, 155))
Exemple #6
0
    def __init__(self, parent, ID, pyutUseCase):
        """
        Constructor.

        @since 1.0
        @author Philippe Waelti <*****@*****.**>
        """
        super().__init__(parent,
                         ID,
                         _("Use Case Edit"),
                         style=RESIZE_BORDER | CAPTION)

        # Associated PyutUseCase
        self._pyutUseCase = pyutUseCase

        self.SetAutoLayout(True)

        self._text = self._pyutUseCase.getName()
        self._returnAction = -1  # describe how the user exited the dialog box

        label = StaticText(self, -1, _("Use case text"))

        self._txtCtrl = TextCtrl(self,
                                 TXT_USECASE,
                                 self._text,
                                 size=(400, 180),
                                 style=TE_MULTILINE)
        self._txtCtrl.SetFocus()

        # text events
        self.Bind(EVT_TEXT, self._onTxtChange, id=TXT_USECASE)

        btnOk = Button(self, OK, _("&Ok"))
        btnOk.SetDefault()
        btnCancel = Button(self, CANCEL, _("&Cancel"))

        self.Bind(EVT_BUTTON, self._onCmdOk, id=OK)
        self.Bind(EVT_BUTTON, self._onCmdCancel, id=CANCEL)

        szrButtons = BoxSizer(HORIZONTAL)
        szrButtons.Add(btnOk, 0, RIGHT, 10)
        szrButtons.Add(btnCancel, 0, ALL)

        szrMain = BoxSizer(VERTICAL)
        szrMain.Add(label, 0, BOTTOM, 5)
        szrMain.Add(self._txtCtrl, 1, EXPAND | BOTTOM, 10)
        szrMain.Add(szrButtons, 0, ALIGN_CENTER_HORIZONTAL)
        # Border
        szrBorder = BoxSizer(VERTICAL)
        szrBorder.Add(szrMain, 1, EXPAND | ALL, 10)
        self.SetSizer(szrBorder)
        szrBorder.Fit(self)

        self.Centre()
        self.ShowModal()
Exemple #7
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)
Exemple #8
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)
Exemple #9
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)
Exemple #10
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)
Exemple #11
0
    def __init__(self,
                 parent,
                 windowId,
                 dlgTitle: str,
                 pyutModel: Union[PyutClass, PyutInterface],
                 editInterface: bool = False):

        super().__init__(parent,
                         windowId,
                         dlgTitle,
                         style=RESIZE_BORDER | CAPTION)

        self._parent = parent  # TODO  Do I really need to stash this

        from org.pyut.ui.Mediator import Mediator

        self.logger: Logger = DlgEditClassCommon.clsLogger
        self._editInterface: bool = editInterface
        self._mediator: Mediator = Mediator()

        self._pyutModel: CommonClassType = pyutModel
        self._pyutModelCopy: CommonClassType = deepcopy(pyutModel)

        self.SetAutoLayout(True)

        if editInterface is True:
            lbl: str = _('Interface Name')
        else:
            lbl = _('Class Name')

        lblName: StaticText = StaticText(self, ID_ANY, lbl)
        self._txtName: TextCtrl = TextCtrl(self,
                                           ID_TEXT_NAME,
                                           "",
                                           size=(125, -1))

        # Name and Stereotype sizer
        self._szrNameStereotype: BoxSizer = BoxSizer(HORIZONTAL)

        self._szrNameStereotype.Add(lblName, 0, ALL | ALIGN_CENTER, 5)
        self._szrNameStereotype.Add(self._txtName, 1, ALIGN_CENTER)

        self._szrButtons: BoxSizer = self.createButtonContainer()

        self._szrMain: BoxSizer = BoxSizer(VERTICAL)

        self._szrMain.Add(self._szrNameStereotype, 0,
                          ALL | ALIGN_CENTER_HORIZONTAL, 5)

        self.SetSizer(self._szrMain)
Exemple #12
0
    def _setupMainDialogLayout(self, textControl: TextCtrl, label: StaticText):

        sizerButtons: BoxSizer = self._createDialogButtons()
        # Sizer for all components
        szrMain: BoxSizer = BoxSizer(VERTICAL)
        szrMain.Add(label, 0, BOTTOM, 5)
        szrMain.Add(textControl, 1, EXPAND | BOTTOM, 10)
        szrMain.Add(sizerButtons, 0, ALIGN_CENTER_HORIZONTAL)

        # Border
        szrBorder: BoxSizer = BoxSizer(VERTICAL)
        szrBorder.Add(szrMain, 1, EXPAND | ALL, 10)
        self.SetSizer(szrBorder)
        szrBorder.Fit(self)
Exemple #13
0
    def layout(self):
        vbox = BoxSizer(VERTICAL)
        self.SetSizer(vbox)
        hbox = BoxSizer(HORIZONTAL)

        hbox.Add(self.start_btn, 1, ALIGN_CENTER | RIGHT, 10)
        hbox.Add(self.pause_btn, 1, ALIGN_CENTER | RIGHT | LEFT, 5)
        hbox.Add(self.reset_btn, 1, ALIGN_CENTER | LEFT, 10)

        vbox.Add(self.time_display, 0, ALIGN_CENTER | ALL, 10)
        vbox.Add(hbox, 1, ALIGN_CENTER)
        vbox.Add(StaticLine(self, ID_ANY, size=(3000, 2)), 0, TOP, 5)

        self.pause_btn.Disable()
        self.reset_btn.Disable()
Exemple #14
0
 def construct_gui(self):
     """Constructs the page GUI"""
     self.scrolled_panel = ScrolledPanel(self)
     self.scrolled_panel.SetAutoLayout(1)
     self.scrolled_panel.SetupScrolling()
     self.main_sizer = BoxSizer(HORIZONTAL)
     self.grid_sizer = FlexGridSizer(1, 10, 10)
     for index, entry in enumerate(self.config):
         self.construct_entry_row(entry, index)
     self.grid_sizer.AddGrowableCol(0, 1)
     scroll_sizer = BoxSizer(HORIZONTAL)
     scroll_sizer.Add(self.grid_sizer, 1, EXPAND | ALL, 20)
     self.scrolled_panel.SetSizer(scroll_sizer)
     self.main_sizer.Add(self.scrolled_panel, 1, EXPAND)
     self.SetSizer(self.main_sizer)
    def __createDialogButtonsContainer(self) -> BoxSizer:

        hs: BoxSizer = BoxSizer(HORIZONTAL)

        btnOk: Button = Button(self, ID_OK, _("&OK"))
        hs.Add(btnOk, 0, ALL, DlgDebugDiagramFrame.CONTAINER_GAP)
        return hs
Exemple #16
0
    def __init__(self, theParent):

        [self.__layoutWidthID, self.__layoutHeightID] = PyutUtils.assignID(2)

        super().__init__(theParent, theTitle='Layout Size')

        self.logger: Logger = getLogger(__name__)

        self._layoutWidth: int = DlgLayoutSize.DEFAULT_LAYOUT_WIDTH
        self._layoutHeight: int = DlgLayoutSize.DEFAULT_LAYOUT_HEIGHT

        hs: Sizer = self._createDialogButtonsContainer(buttons=OK | CANCEL)
        layoutControls: StaticBoxSizer = self.__createLayoutSizeControls()

        mainSizer: BoxSizer = BoxSizer(orient=VERTICAL)

        mainSizer.Add(layoutControls, 0, CENTER)
        mainSizer.Add(hs, 0, CENTER)

        self.SetSizer(mainSizer)

        mainSizer.Fit(self)

        self.Bind(EVT_SPINCTRL, self.__OnSizeChange, id=self.__layoutWidthID)
        self.Bind(EVT_SPINCTRL, self.__OnSizeChange, id=self.__layoutHeightID)

        self.Bind(EVT_BUTTON, self._OnCmdOk, id=ID_OK)
        self.Bind(EVT_CLOSE, self._OnClose)
Exemple #17
0
    def _createDialogButtonsContainer(self, buttons=OK) -> BoxSizer:
        """
        Override base class with our custom version
        Args:
            buttons:    Unused in our implementation.

        Returns: The container
        """
        self._btnMethodCode: Button = Button(self, ID_BTN_METHOD_CODE,
                                             _('C&ode'))
        self._btnMethodOk: Button = Button(self, ID_BTN_METHOD_OK, _('&Ok'))
        self._btnMethodCancel: Button = Button(self, ID_BTN_METHOD_CANCEL,
                                               _('&Cancel'))

        self.Bind(EVT_BUTTON, self._onMethodCode, id=ID_BTN_METHOD_CODE)
        self.Bind(EVT_BUTTON, self._onMethodOk, id=ID_BTN_METHOD_OK)
        self.Bind(EVT_BUTTON, self._onMethodCancel, id=ID_BTN_METHOD_CANCEL)

        self._btnMethodOk.SetDefault()

        szrButtons: BoxSizer = BoxSizer(HORIZONTAL)
        szrButtons.Add(self._btnMethodCode, 0, ALL, 5)
        szrButtons.Add(self._btnMethodOk, 0, ALL, 5)
        szrButtons.Add(self._btnMethodCancel, 0, ALL, 5)

        return szrButtons
Exemple #18
0
    def _createParameterButtonsContainer(self) -> BoxSizer:

        self._btnParamAdd: Button = Button(self, ID_BTN_PARAM_ADD, _("&Add"))
        self._btnParamEdit: Button = Button(self, ID_BTN_PARAM_EDIT,
                                            _("&Edit"))
        self._btnParamRemove: Button = Button(self, ID_BTN_PARAM_REMOVE,
                                              _("&Remove"))
        self._btnParamUp: Button = Button(self, ID_BTN_PARAM_UP, _("&Up"))
        self._btnParamDown: Button = Button(self, ID_BTN_PARAM_DOWN,
                                            _("&Down"))

        self.Bind(EVT_BUTTON, self._onParamAdd, id=ID_BTN_PARAM_ADD)
        self.Bind(EVT_BUTTON, self._onParamEdit, id=ID_BTN_PARAM_EDIT)
        self.Bind(EVT_BUTTON, self._onParamRemove, id=ID_BTN_PARAM_REMOVE)
        self.Bind(EVT_BUTTON, self._onParamUp, id=ID_BTN_PARAM_UP)
        self.Bind(EVT_BUTTON, self._onParamDown, id=ID_BTN_PARAM_DOWN)

        szrParamButtons: BoxSizer = BoxSizer(HORIZONTAL)

        szrParamButtons.Add(self._btnParamAdd, 0, ALL, 5)
        szrParamButtons.Add(self._btnParamEdit, 0, ALL, 5)
        szrParamButtons.Add(self._btnParamRemove, 0, ALL, 5)
        szrParamButtons.Add(self._btnParamUp, 0, ALL, 5)
        szrParamButtons.Add(self._btnParamDown, 0, ALL, 5)

        return szrParamButtons
Exemple #19
0
    def __init__(self, parent, title=u"NumberInput"):
        Dialog.__init__(self,
                        parent,
                        title=title,
                        size=(320, 240),
                        style=BORDER_NONE)
        pnl = NumberInputWindowPanel(self)

        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_0)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_1)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_2)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_3)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_4)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_5)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_6)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_7)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_8)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_9)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_00)

        self.Bind(EVT_BUTTON, pnl.on_delete, pnl.keypad_del)

        self.Bind(EVT_BUTTON, self.on_confirm, pnl.keypad_confirm)
        self.Bind(EVT_BUTTON, self.on_cancel, pnl.keypad_cancel)

        self.pnl = pnl

        # self._set_panel(pnl)
        self._sizer = BoxSizer()
        self._sizer.Clear()
        self._sizer.Add(self.pnl)
        self.SetSizer(self._sizer)
Exemple #20
0
    def _createControls(self):
        """
        Creates the main control and stashes them as private instance variables
        """
        mainSizer: BoxSizer = BoxSizer(VERTICAL)

        mainSizer.Add(self.__createSimpleGridOptions(), 0, TOP | EXPAND,
                      BackgroundPreferences.VERTICAL_GAP)
        mainSizer.Add(self.__createGridLineColorContainer(), 0, TOP | EXPAND,
                      BackgroundPreferences.VERTICAL_GAP)
        mainSizer.Add(self.__createGridStyleChoice(), 0, TOP | EXPAND,
                      BackgroundPreferences.VERTICAL_GAP)

        self.SetAutoLayout(True)
        self.SetSizer(mainSizer)

        self.Bind(EVT_COMBOBOX, self.onGridLineColorSelectionChanged,
                  self._cmbGridLineColor)

        self.Bind(EVT_CHECKBOX, self.onEnableBackgroundGridChanged,
                  self.enableBackgroundGridID)
        self.Bind(EVT_CHECKBOX, self.onSnapToGridChanged, self.snapToGridID)

        self.Bind(EVT_SPINCTRL, self.onGridIntervalChanged,
                  self._scGridInterval)

        self.Bind(EVT_CHOICE, self.onGridStyleChanged, self._gridStyleChoice)
Exemple #21
0
    def __createSimpleGridOptions(self) -> BoxSizer:

        szrSimple: BoxSizer = BoxSizer(VERTICAL)

        cbEnableBackgroundGrid: CheckBox = CheckBox(
            self, self.enableBackgroundGridID, _('Enable Background Grid'))
        cbSnapToGrid: CheckBox = CheckBox(self, self.snapToGridID,
                                          _('Snap to Grid'))

        box: StaticBox = StaticBox(self, ID_ANY, _("Grid Interval"))
        szrGridInterval: StaticBoxSizer = StaticBoxSizer(
            box, HORIZONTAL | ALIGN_LEFT)

        scGridInterval: SpinCtrl = SpinCtrl(self, self.scGridIntervalID, "")

        szrGridInterval.Add(scGridInterval, 0, LEFT | RIGHT,
                            BackgroundPreferences.HORIZONTAL_GAP)

        szrSimple.Add(cbEnableBackgroundGrid, 0, LEFT | RIGHT,
                      BackgroundPreferences.VERTICAL_GAP)
        szrSimple.Add(cbSnapToGrid, 0, LEFT | BOTTOM,
                      BackgroundPreferences.VERTICAL_GAP)

        szrSimple.AddSpacer(BackgroundPreferences.VERTICAL_GAP)
        szrSimple.Add(szrGridInterval, 0, LEFT | RIGHT | TOP,
                      BackgroundPreferences.VERTICAL_GAP)

        self._cbEnableBackgroundGrid: CheckBox = cbEnableBackgroundGrid
        self._cbSnapToGrid: CheckBox = cbSnapToGrid
        self._scGridInterval: SpinCtrl = scGridInterval

        return szrSimple
Exemple #22
0
    def __init__(self, parent: Window):

        super().__init__(parent, ID_ANY)
        self._preferences: PyutPreferences = PyutPreferences()
        #
        # Controls we are going to create
        #
        self._noteTextContainer: TextContainer = cast(TextContainer, None)
        self._noteDimensions: DimensionsContainer = cast(
            DimensionsContainer, None)

        szrNotes: BoxSizer = BoxSizer(VERTICAL)

        szrDefaultNoteText: BoxSizer = self._createDefaultNoteTextContainer(
            parent=self)
        szrNoteSize: DimensionsContainer = self._createDefaultNoteSizeContainer(
            parent=self)

        szrNotes.Add(szrDefaultNoteText, 0, ALL,
                     NoteAttributesContainer.VERTICAL_GAP)
        szrNotes.Add(szrNoteSize, 0, ALL, NoteAttributesContainer.VERTICAL_GAP)

        self._setControlValues()

        self.SetSizer(szrNotes)
        self.Fit()
    def __init__(self, theParent, imageOptions: ImageOptions = ImageOptions()):

        [
            self.__selectedFileId, self.__imageWidthId, self.__imageHeightId,
            self.__horizontalGapId, self.__verticalGapId, self.__fileSelectBtn,
            self.__imageFormatChoiceId
        ] = PyutUtils.assignID(7)

        super().__init__(theParent, theTitle='UML Image Generation Options')

        self.logger: Logger = getLogger(__name__)
        self._imageOptions: ImageOptions = imageOptions

        fs: StaticBoxSizer = self.__layoutFileSelection()
        imgS: StaticBoxSizer = self.__layoutImageSizeControls()
        imgF: StaticBoxSizer = self.__layoutImageFormatChoice()
        imgP: StaticBoxSizer = self.__layoutImagePadding()

        hs: Sizer = self._createDialogButtonsContainer(buttons=OK | CANCEL)

        mainSizer: BoxSizer = BoxSizer(orient=VERTICAL)
        mainSizer.Add(fs, 0, ALL | EXPAND, 5)
        mainSizer.Add(imgS, 0, ALL, 5)
        mainSizer.Add(imgF, 0, ALL, 5)
        mainSizer.Add(imgP, 0, ALL, 5)
        mainSizer.Add(hs, 0, ALIGN_RIGHT)

        self.SetSizer(mainSizer)

        mainSizer.Fit(self)
        self._bindEventHandlers()

        self.Bind(EVT_BUTTON, self._OnCmdOk, id=ID_OK)
        self.Bind(EVT_CLOSE, self._OnClose, id=ID_CANCEL)
Exemple #24
0
    def __init__(self, theParent):

        [self.__layoutWidthID, self.__layoutHeightID] = PyutUtils.assignID(2)

        super().__init__(theParent, theTitle='Layout Size')

        self.logger:       Logger          = getLogger(__name__)
        self._preferences: PyutPreferences = PyutPreferences()

        self._layoutWidth:  int = self._preferences.orthogonalLayoutSize.width
        self._layoutHeight: int = self._preferences.orthogonalLayoutSize.height

        hs:             Sizer               = self._createDialogButtonsContainer(buttons=OK | CANCEL)
        layoutControls: DimensionsContainer = self.__createLayoutSizeControls()

        mainSizer: BoxSizer = BoxSizer(orient=VERTICAL)

        mainSizer.Add(layoutControls, 0, CENTER)
        mainSizer.Add(hs, 0, CENTER)

        self.SetSizer(mainSizer)

        mainSizer.Fit(self)

        self.Bind(EVT_BUTTON, self._OnCmdOk, id=ID_OK)
        self.Bind(EVT_CLOSE,  self._OnClose)
Exemple #25
0
    def _createControls(self):
        """
        Creates the main control and stashes them as private instance variables
        """

        self.__cbMaximize:        CheckBox = CheckBox(self, self.__maximizeID,        _('&Full Screen on startup'))
        self.__cbAutoResize:      CheckBox = CheckBox(self, self.__autoResizeID,      _('&Auto resize classes to fit content'))
        self.__cbShowParams:      CheckBox = CheckBox(self, self.__showParamsID,      _("&Show method parameters"))
        self.__cbShowTips:        CheckBox = CheckBox(self, self.__showTipsID,        _("Show &Tips on startup"))
        self.__cbCenterDiagram:   CheckBox = CheckBox(self, self.__centerDiagramID,   _('&Center Diagram View'))
        self.__cbToolBarIconSize: CheckBox = CheckBox(self, self.__toolBarIconSizeID, _('&Large Toolbar Icons'))

        self.__btnResetTips: Button = Button(self, self.__resetTipsID, _('Reset Tips'))

        mainSizer: BoxSizer = BoxSizer(VERTICAL)

        mainSizer.Add(self.__cbAutoResize,      0, ALL, GeneralPreferencesPanel.VERTICAL_GAP)
        mainSizer.Add(self.__cbShowParams,      0, ALL, GeneralPreferencesPanel.VERTICAL_GAP)
        mainSizer.Add(self.__cbMaximize,        0, ALL, GeneralPreferencesPanel.VERTICAL_GAP)
        mainSizer.Add(self.__cbCenterDiagram,   0, ALL, GeneralPreferencesPanel.VERTICAL_GAP)
        mainSizer.Add(self.__cbShowTips,        0, ALL, GeneralPreferencesPanel.VERTICAL_GAP)
        mainSizer.Add(self.__cbToolBarIconSize, 0, ALL, GeneralPreferencesPanel.VERTICAL_GAP)

        mainSizer.Add(self.__btnResetTips,   0, ALL, GeneralPreferencesPanel.VERTICAL_GAP)

        self.SetAutoLayout(True)
        self.SetSizer(mainSizer)

        self.Bind(EVT_CHECKBOX, self.__OnCheckBox, id=self.__autoResizeID)
        self.Bind(EVT_CHECKBOX, self.__OnCheckBox, id=self.__showParamsID)
        self.Bind(EVT_CHECKBOX, self.__OnCheckBox, id=self.__maximizeID)
        self.Bind(EVT_CHECKBOX, self.__OnCheckBox, id=self.__showTipsID)
        self.Bind(EVT_CHECKBOX, self.__OnCheckBox, id=self.__toolBarIconSizeID)

        self.Bind(EVT_BUTTON,   self.__OnBtnResetTips, id=self.__resetTipsID)
Exemple #26
0
    def __init__(self, parent):
        """
        """
        dialogStyle: int = RESIZE_BORDER | SYSTEM_MENU | CAPTION | FRAME_FLOAT_ON_PARENT | STAY_ON_TOP
        dialogSize: Size = Size(DEFAULT_WIDTH, DEFAULT_HEIGHT)
        super().__init__(parent, ID_ANY, _("Tips"), DefaultPosition,
                         dialogSize, dialogStyle)

        self._prefs: PyutPreferences = PyutPreferences()
        self._tipsFileName: str = PyutUtils.retrieveResourcePath(
            f'{DlgTips.TIPS_FILENAME}')

        self._tipHandler = TipHandler(fqFileName=self._tipsFileName)

        upSizer: BoxSizer = self._buildUpperDialog(
            self._tipHandler.getCurrentTipText())
        loSizer: BoxSizer = self._buildLowerDialog()

        self.SetAutoLayout(True)

        mainSizer: BoxSizer = BoxSizer(VERTICAL)

        mainSizer.Add(upSizer, WX_SIZER_NOT_CHANGEABLE, ALL | ALIGN_CENTER, 5)
        mainSizer.Add(self._chkShowTips, WX_SIZER_NOT_CHANGEABLE,
                      ALL | ALIGN_CENTER, 5)
        mainSizer.Add(loSizer, WX_SIZER_NOT_CHANGEABLE, ALL | ALIGN_CENTER, 5)

        mainSizer.Fit(self)

        self.Center(dir=VERTICAL)
        self.AcceptsFocus()
        self.SetSizer(mainSizer)

        self._bindEventHandlers()
Exemple #27
0
    def __init__(self, parent):
        Panel.__init__(self, parent=parent)
        self.panels = {}
        self.currentPanelKey = 0

        self.sizer = BoxSizer(VERTICAL)
        self.SetSizer(self.sizer)
    def _createControls(self):
        """
        Creates the main control and stashes them as private instance variables
        """

        self.__cbCenterAppOnStartup: CheckBox = CheckBox(
            self, self.__centerAppOnStartupId, _('Center Pyut on Startup'))

        mainSizer: BoxSizer = BoxSizer(VERTICAL)

        mainSizer.Add(self.__cbCenterAppOnStartup, 0, ALL,
                      PositioningPreferences.VERTICAL_GAP)
        mainSizer.Add(self.__createAppPositionControls(), 0, ALL,
                      PositioningPreferences.VERTICAL_GAP)
        mainSizer.Add(self.__createAppSizeControls(), 0, ALL,
                      PositioningPreferences.VERTICAL_GAP)

        self._setControlValues()

        self.Bind(EVT_CHECKBOX,
                  self.__onCenterOnStartupChanged,
                  id=self.__centerAppOnStartupId)

        self.SetAutoLayout(True)
        self.SetSizer(mainSizer)
Exemple #29
0
    def __init__(self, parent: Window, wxID: int = wxNewIdRef()):

        super().__init__(parent,
                         wxID,
                         'About',
                         DefaultPosition,
                         size=Size(width=390, height=250))

        self._versionFont: Font = self.GetFont()

        self._versionFont.SetFamily(FONTFAMILY_DEFAULT)

        self._version: Version = Version()  # Get the singleton

        dlgButtonsContainer: Sizer = self._createDialogButtonsContainer()

        # Main sizer
        mainSizer: BoxSizer = BoxSizer(VERTICAL)
        dialogSizer: BoxSizer = self._createUpperDialog()

        mainSizer.Add(dialogSizer, 0, ALL | ALIGN_LEFT, 5)
        mainSizer.Add(dlgButtonsContainer, 0, ALL | ALIGN_CENTER, 5)

        # noinspection PyUnresolvedReferences
        self.SetAutoLayout(True)
        # noinspection PyUnresolvedReferences
        self.SetSizer(mainSizer)
        self.Center(BOTH)
        self.SetBackgroundColour(WHITE)

        self.Bind(EVT_BUTTON, self._onOk, id=ID_OK)
        self.Bind(EVT_CLOSE, self._onOk)
    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)