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 _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 #3
0
def button(element, instance: wx.Button):
    props = element['props']
    set_basic_props(instance, props)
    instance.Unbind(wx.EVT_BUTTON)
    if props.get('on_click'):
        instance.Bind(wx.EVT_BUTTON, props['on_click'])
    return instance
Exemple #4
0
    def __init__(self, ch: int, channel_label: wx.StaticText,
                 waveform_choice: wx.Choice, trigger_choice: wx.Choice,
                 continuous_toggle: wx.ToggleButton, trigger_button: wx.Button,
                 stop_button: wx.Button, trigger_out_check: wx.CheckBox,
                 status_text: wx.TextCtrl, mf):
        self.ch = ch
        self.mf = mf
        self.channel_label = channel_label
        self.channel_name = channel_label.GetLabel()
        self.waveform_choice = waveform_choice
        self.waveform_choice.Bind(wx.EVT_CHOICE, self.on_waveform_choice)
        self.trigger_choice = trigger_choice
        self.trigger_choice.Bind(wx.EVT_CHOICE, self.on_trigger_source)
        self.continuous_toggle = continuous_toggle
        self.continuous_toggle.Bind(wx.EVT_TOGGLEBUTTON, self.on_toggle)
        self.trigger_button = trigger_button
        trigger_button.Bind(wx.EVT_BUTTON,
                            lambda _: mf.device.trigger_channel(ch))
        self.stop_button = stop_button
        self.stop_button.Bind(
            wx.EVT_BUTTON, lambda evt: mf.device.set_enable(
                ch,
                stop_button.GetLabel() == 'Enable'))
        self.trigger_out_check = trigger_out_check
        self.status_text = status_text

        self.waveform = 'Waveform 1'
        self.trigger = 0
        self.continuous = 0
        self._enabled = False
        self.output = False
        self.warnings = []
        self.modified = False
Exemple #5
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 #6
0
    def OnInit(self):

        PyutPreferences.determinePreferencesLocation()

        frameTop: Frame = Frame(parent=None,
                                id=TestMiniOglApp.FRAME_ID,
                                title="Test miniogl",
                                size=(TestMiniOglApp.WINDOW_WIDTH,
                                      TestMiniOglApp.WINDOW_HEIGHT),
                                style=DEFAULT_FRAME_STYLE)
        frameTop.Show(True)

        diagramFrame: DiagramFrame = DiagramFrame(frameTop)
        diagramFrame.SetSize(
            (TestMiniOglApp.WINDOW_WIDTH, TestMiniOglApp.WINDOW_HEIGHT))
        diagramFrame.SetScrollbars(10, 10, 100, 100)

        button = Button(frameTop, 1003, "Draw Me")
        button.SetPosition((15, 15))
        self.Bind(EVT_BUTTON, self.onDrawMe, button)

        diagramFrame.Show(True)

        self.SetTopWindow(diagramFrame)

        self._diagramFrame: DiagramFrame = diagramFrame

        self.initTest()

        return True
Exemple #7
0
    def __init__(self, parent, title, values):
        Dialog.__init__(self,
                        parent,
                        title=title,
                        style=DEFAULT_DIALOG_STYLE | RESIZE_BORDER)
        self.values = None

        sizer = GridBagSizer(5, 5)
        row = 0
        self.labels = []
        self.txt_ctrls = []
        for value in values:
            label = StaticText(self, label=value)
            self.labels.append(label)
            sizer.Add(label, pos=(row, 0), flag=ALIGN_RIGHT)

            txtctrl = TextCtrl(self)
            self.txt_ctrls.append(txtctrl)
            sizer.Add(txtctrl, pos=(row, 1), flag=FLAG_ALL_AND_EXPAND)
            row += 1

        self.btn_cancel = Button(self, label=u'Cancel')
        self.btn_cancel.Bind(EVT_BUTTON, self.__on_btn)
        sizer.Add(self.btn_cancel, pos=(row, 0), flag=FLAG_ALL_AND_EXPAND)

        self.btn_ok = Button(self, label=u'OK')
        self.btn_ok.Bind(EVT_BUTTON, self.__on_btn)
        sizer.Add(self.btn_ok, pos=(row, 1), flag=FLAG_ALL_AND_EXPAND)

        sizer.AddGrowableCol(1)
        self.SetSizerAndFit(sizer)
        self.SetSize(400, self.GetSizeTuple()[1])
Exemple #8
0
    def __init__(self,
                 message: str,
                 label: str = None,
                 url: str = None,
                 **kwargs) -> None:
        super(HyperlinkDialog, self).__init__(parent=None, **kwargs)
        pane = self.GetContentsPane()

        text_ctrl = StaticText(pane, label=message)
        text_ctrl.SetFocus()
        text_ctrl.SetSizerProps(align="center")

        if url is not None:
            if label is None:
                label = url
            hyperlink = HyperlinkCtrl(pane, label=label, url=url)
            hyperlink.Bind(EVT_HYPERLINK, self.on_hyperlink)

        button_ok = Button(pane, label="OK")
        button_ok.Bind(EVT_BUTTON, self.on_ok)
        button_ok.SetSizerProps(align="center", border=(["top"], 10))

        self.SetIcon(
            Icon(ArtProvider.GetBitmap(ART_INFORMATION, ART_MESSAGE_BOX)))
        self.Fit()
        self.Centre()
Exemple #9
0
class MultipleTextEntry(Dialog):
    def __init__(self, parent, title, values):
        Dialog.__init__(self,
                        parent,
                        title=title,
                        style=DEFAULT_DIALOG_STYLE | RESIZE_BORDER)
        self.values = None

        sizer = GridBagSizer(5, 5)
        row = 0
        self.labels = []
        self.txt_ctrls = []
        for value in values:
            label = StaticText(self, label=value)
            self.labels.append(label)
            sizer.Add(label, pos=(row, 0), flag=ALIGN_RIGHT)

            txtctrl = TextCtrl(self)
            self.txt_ctrls.append(txtctrl)
            sizer.Add(txtctrl, pos=(row, 1), flag=FLAG_ALL_AND_EXPAND)
            row += 1

        self.btn_cancel = Button(self, label=u'Cancel')
        self.btn_cancel.Bind(EVT_BUTTON, self.__on_btn)
        sizer.Add(self.btn_cancel, pos=(row, 0), flag=FLAG_ALL_AND_EXPAND)

        self.btn_ok = Button(self, label=u'OK')
        self.btn_ok.Bind(EVT_BUTTON, self.__on_btn)
        sizer.Add(self.btn_ok, pos=(row, 1), flag=FLAG_ALL_AND_EXPAND)

        sizer.AddGrowableCol(1)
        self.SetSizerAndFit(sizer)
        self.SetSize(400, self.GetSizeTuple()[1])

    def __on_btn(self, evt):
        errors = []
        obj = evt.GetEventObject()
        if obj == self.btn_ok:
            self.values = {}
            for txt_ctrl in self.txt_ctrls:
                label_ctrl = self.labels[self.txt_ctrls.index(txt_ctrl)]
                label = label_ctrl.GetLabel()
                value = txt_ctrl.GetValue()
                self.values[label] = value
                if len(value) == 0:
                    errors.append(u"Variable '%s' has empty value '%s'" %
                                  (label, value))

            return_code = ID_OK
        else:
            self.values = None
            return_code = ID_CANCEL

        if len(errors) > 0:
            show_dialog(self, LINESEP.join(errors), 'Bad entered data')
        else:
            self.EndModal(return_code)
Exemple #10
0
class CategoryInputWindowPanel(BaseWindowPanel):
    EMPTY_ITEM = '<empty>'

    def __init__(self, parent, title, categories):
        BaseWindowPanel.__init__(self,
                                 parent,
                                 bg_color=Colour.BLACK,
                                 fg_color=Colour.WHITE)

        # Title Label
        self._title_label = StaticText(self,
                                       pos=(85, 10),
                                       size=(100, 30),
                                       label=title)
        self._title_label.SetFont(
            Font(20, FONTFAMILY_DEFAULT, FONTSTYLE_NORMAL, FONTWEIGHT_NORMAL))

        # Cancel Button
        self._cancel_button = Button(self,
                                     -1,
                                     "Cancel",
                                     pos=(10, 10),
                                     size=(70, 30))
        self._cancel_button.SetBackgroundColour(Colour.DARK_RED)
        self._cancel_button.SetForegroundColour(Colour.WHITE)

        # Confirm Button
        self._confirm_button = Button(self,
                                      -1,
                                      "OK",
                                      pos=(240, 10),
                                      size=(70, 30))
        self._confirm_button.SetBackgroundColour(Colour.DARK_GREEN)
        self._confirm_button.SetForegroundColour(Colour.WHITE)

        # List Views
        self._list_control = ListBox(self, pos=(10, 50), size=(295, 170))
        self._list_control.SetBackgroundColour(Colour.BLACK)
        self._list_control.SetForegroundColour(Colour.WHITE)
        self._list_control.SetItems([CategoryInputWindowPanel.EMPTY_ITEM] +
                                    categories)

        # Event
        self.Bind(EVT_BUTTON, self._confirm_button_click, self._confirm_button)
        self.Bind(EVT_BUTTON, self._cancel_button_click, self._cancel_button)

    def _cancel_button_click(self, e):
        self.GetParent().EndModal(ID_CANCEL)

    def _confirm_button_click(self, e):
        self.GetParent().EndModal(ID_OK)

    def get_value(self):
        v = self._list_control.GetStringSelection()
        return "" if v == CategoryInputWindowPanel.EMPTY_ITEM else v
Exemple #11
0
class EntryListWindowPanel(BaseWindowPanel):
    def __init__(self, parent):
        BaseWindowPanel.__init__(self,
                                 parent,
                                 bg_color=Colour.BLACK,
                                 fg_color=Colour.WHITE)

        self._title_label = StaticText(self,
                                       pos=(110, 10),
                                       size=(100, 30),
                                       label=u"Entries")
        self._title_label.SetFont(
            Font(20, FONTFAMILY_DEFAULT, FONTSTYLE_NORMAL, FONTWEIGHT_NORMAL))

        self._back_button = Button(self,
                                   -1,
                                   "< Back",
                                   pos=(10, 10),
                                   size=(70, 30))
        self._back_button.SetBackgroundColour(get_colour(0x333333))
        self._back_button.SetForegroundColour(Colour.WHITE)

        self._delete_button = Button(self,
                                     -1,
                                     "Del",
                                     pos=(240, 10),
                                     size=(70, 30))
        self._delete_button.SetBackgroundColour(Colour.RED)
        self._delete_button.SetForegroundColour(Colour.WHITE)

        self._list_control = ListBox(self, pos=(10, 50), size=(295, 170))
        self._list_control.SetBackgroundColour(Colour.BLACK)
        self._list_control.SetForegroundColour(Colour.WHITE)

        self._items = GlobalStorage.get_storage().get_items()
        self._list_control.SetItems(
            GlobalStorage.get_storage().get_string_list(self._items))

        self.Bind(EVT_BUTTON, self._back_button_click, self._back_button)
        self.Bind(EVT_BUTTON, self._delete_button_click, self._delete_button)

    def _back_button_click(self, e):
        self.GetParent().EndModal(ID_OK)

    def _delete_button_click(self, e):
        sel = self._list_control.GetSelection()
        if sel == NOT_FOUND:
            return
        else:
            item = self._items[sel]
            GlobalStorage.get_storage().delete_item(item.Id)

            self._items = GlobalStorage.get_storage().get_items()
            self._list_control.SetItems(
                GlobalStorage.get_storage().get_string_list(self._items))
Exemple #12
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 #13
0
    def __create_widgets(self):
        sizer = GridBagSizer(5, 5)

        row = 0
        col = 0

        # first row
        label = StaticText(self, label=u'Selected area:')
        sizer.Add(label, pos=(row, col))

        col += 1
        self.txt_selected_area = TextCtrl(self, value=u'(0, 0, 0, 0)')
        sizer.Add(self.txt_selected_area,
                  pos=(row, col),
                  flag=FLAG_ALL_AND_EXPAND)

        col += 1
        label = StaticText(self, label=u'Class name:')
        sizer.Add(label, pos=(row, col))

        col += 1
        self.txt_class_name = TextCtrl(self)
        sizer.Add(self.txt_class_name,
                  pos=(row, col),
                  flag=FLAG_ALL_AND_EXPAND)

        col += 1
        self.bth_reload_img = Button(self, label=u'Reload image')
        self.bth_reload_img.Bind(EVT_BUTTON, self.__load_img)
        sizer.Add(self.bth_reload_img,
                  pos=(row, col),
                  flag=FLAG_ALL_AND_EXPAND)

        col += 1
        self.btn_generate = Button(self, label=u'Generate')
        self.btn_generate.Bind(EVT_BUTTON, self.generate)
        sizer.Add(self.btn_generate, pos=(row, col), flag=FLAG_ALL_AND_EXPAND)

        # second row
        row += 1
        col = 0
        self.select_image_panel = SelectableImagePanel(self)
        self.select_image_panel.static_bitmap.Bind(EVT_MOTION,
                                                   self._on_mouse_move)
        sizer.Add(self.select_image_panel,
                  pos=(row, col),
                  span=(1, 6),
                  flag=FLAG_ALL_AND_EXPAND)

        sizer.AddGrowableCol(1, 1)
        sizer.AddGrowableRow(row, 1)

        self.SetSizer(sizer)
Exemple #14
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 #15
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 #16
0
    def __init__(self, parent, id, title):
        # zavolání konstruktoru předka (kompatibilní s Pythonem 2.x)
        super(MainFrame, self).__init__(parent, id, title, size=(320, 240))

        # vytvoření panelu
        panel = Panel(self, ID_ANY)

        # vytvoření tlačítka s jeho vložením do panelu
        x = y = 20
        button = Button(panel, ID_ANY, "Press me", (x, y))
        button.Bind(EVT_BUTTON, onButtonPress)

        # zobrazení hlavního okna aplikace
        self.Show(True)
Exemple #17
0
class DialogWithText(Dialog):
    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)

    def __close(self, evt):
        self.EndModal(ID_OK)
        self.Hide()
Exemple #18
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)
    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
    def __createDialogButtonsContainer(self) -> BoxSizer:

        hs: BoxSizer = BoxSizer(HORIZONTAL)

        btnOk: Button = Button(self, ID_OK, _("&OK"))
        hs.Add(btnOk, 0, ALL, DlgPyutPreferences.HORIZONTAL_GAP)

        return hs
Exemple #21
0
    def __init__(self, parent, ID, pyutModel: Union[PyutClass, PyutInterface]):
        """

        Args:
            parent:
            ID:
            pyutModel:
        """

        super().__init__(parent, ID, _("Description Edit"))

        # Associated PyutLink
        self._pyutModel: Union[PyutClass, PyutInterface] = pyutModel

        self.SetSize(Size(416, 200))

        # init members vars
        self._text = self._pyutModel.description
        self._returnAction = OK  # describe how the user exited the dialog box

        # labels
        StaticText(self, ID_ANY, _("Class description"), Point(8, 8))

        # text
        self._txtCtrl: TextCtrl = TextCtrl(self, TXT_COMMENT, self._text,
                                           Point(8, 24), Size(392, 100),
                                           TE_MULTILINE)

        # Set the focus
        self._txtCtrl.SetFocus()

        # text events
        self.Bind(EVT_TEXT, self._onTxtNoteChange, id=TXT_COMMENT)

        # Ok/Cancel
        Button(self, OK, _("&Ok"), Point(120, 140))
        Button(self, CANCEL, _("&Cancel"), Point(208, 140))

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

        self.Centre()
        self.ShowModal()
Exemple #22
0
    def __init__(self, parent, id, title):
        # zavolání konstruktoru předka (kompatibilní s Pythonem 2.x)
        super(MainFrame, self).__init__(parent, id, title, size=(320, 240))

        # vytvoření tlačítka s jeho přímým vložením do rámce
        x = y = 20
        button = Button(self, ID_ANY, "Press me", (x, y))

        # zobrazení hlavního okna aplikace
        self.Show(True)
Exemple #23
0
    def __init__(self, parent, title, categories):
        BaseWindowPanel.__init__(self,
                                 parent,
                                 bg_color=Colour.BLACK,
                                 fg_color=Colour.WHITE)

        # Title Label
        self._title_label = StaticText(self,
                                       pos=(85, 10),
                                       size=(100, 30),
                                       label=title)
        self._title_label.SetFont(
            Font(20, FONTFAMILY_DEFAULT, FONTSTYLE_NORMAL, FONTWEIGHT_NORMAL))

        # Cancel Button
        self._cancel_button = Button(self,
                                     -1,
                                     "Cancel",
                                     pos=(10, 10),
                                     size=(70, 30))
        self._cancel_button.SetBackgroundColour(Colour.DARK_RED)
        self._cancel_button.SetForegroundColour(Colour.WHITE)

        # Confirm Button
        self._confirm_button = Button(self,
                                      -1,
                                      "OK",
                                      pos=(240, 10),
                                      size=(70, 30))
        self._confirm_button.SetBackgroundColour(Colour.DARK_GREEN)
        self._confirm_button.SetForegroundColour(Colour.WHITE)

        # List Views
        self._list_control = ListBox(self, pos=(10, 50), size=(295, 170))
        self._list_control.SetBackgroundColour(Colour.BLACK)
        self._list_control.SetForegroundColour(Colour.WHITE)
        self._list_control.SetItems([CategoryInputWindowPanel.EMPTY_ITEM] +
                                    categories)

        # Event
        self.Bind(EVT_BUTTON, self._confirm_button_click, self._confirm_button)
        self.Bind(EVT_BUTTON, self._cancel_button_click, self._cancel_button)
Exemple #24
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)
Exemple #25
0
    def _buildLowerDialog(self) -> BoxSizer:

        nextTipButton: Button = Button(self, ID_SET_NEXT_TIP, _("&Next tip"))
        previousTipButton: Button = Button(self, ID_SET_PREVIOUS_TIP,
                                           _("&Previous tip"))

        loSizer: BoxSizer = BoxSizer(HORIZONTAL)

        loSizer.Add(previousTipButton, WX_SIZER_NOT_CHANGEABLE,
                    ALL | ALIGN_CENTER, 5)
        loSizer.Add(nextTipButton, WX_SIZER_NOT_CHANGEABLE, ALL | ALIGN_CENTER,
                    5)
        loSizer.Add(Button(self, ID_OK, "&Ok"), 0, ALL | ALIGN_CENTER, 5)

        self._chkShowTips: CheckBox = CheckBox(self, ID_CHK_SHOW_TIPS,
                                               _("&Show tips at startup"))

        showTips: bool = self._prefs.showTipsOnStartup
        self._chkShowTips.SetValue(showTips)

        return loSizer
Exemple #26
0
    def _createDialogButtons(self) -> BoxSizer:
        """
        Creates the buttons and assigns the handlers

        Returns:
            The container that holds the dialog buttons
        """

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

        btnOk.SetDefault()

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

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

        return sizerButtons
Exemple #27
0
    def OnInit(self):

        self.InitInspection()

        frameTop: Frame = Frame(parent=None,
                                id=TestWxOgl.FRAME_ID,
                                title="Test WX Ogl",
                                size=(TestWxOgl.WINDOW_WIDTH,
                                      TestWxOgl.WINDOW_HEIGHT),
                                style=DEFAULT_FRAME_STYLE)

        OGLInitialize()

        testWindow: TestWindow = TestWindow(frameTop)

        button = Button(testWindow, 1003, "Draw Me")
        button.SetPosition((15, 15))
        self.Bind(EVT_BUTTON, self.onDrawMe, button)

        frameTop.SetSize((800, 600))
        testWindow.SetFocus()

        self.window: TestWindow = testWindow
        self.frameRect: Rect = frameTop.GetRect()

        frameTop.Bind(EVT_CLOSE, self._onCloseFrame)

        menuBar: MenuBar = MenuBar()
        menu: Menu = Menu()

        item = menu.Append(-1, "&Widget Inspector\tF6",
                           "Show the wxPython Widget Inspection Tool")
        self.Bind(wx.EVT_MENU, self.onWidgetInspector, item)

        menuBar.Append(menu, "&File")

        frameTop.SetMenuBar(menuBar)
        frameTop.Show(True)

        return True
Exemple #28
0
    def __init__(self, parent):
        BaseWindowPanel.__init__(self,
                                 parent,
                                 bg_color=Colour.BLACK,
                                 fg_color=Colour.WHITE)

        self._title_label = StaticText(self,
                                       pos=(110, 10),
                                       size=(100, 30),
                                       label=u"Entries")
        self._title_label.SetFont(
            Font(20, FONTFAMILY_DEFAULT, FONTSTYLE_NORMAL, FONTWEIGHT_NORMAL))

        self._back_button = Button(self,
                                   -1,
                                   "< Back",
                                   pos=(10, 10),
                                   size=(70, 30))
        self._back_button.SetBackgroundColour(get_colour(0x333333))
        self._back_button.SetForegroundColour(Colour.WHITE)

        self._delete_button = Button(self,
                                     -1,
                                     "Del",
                                     pos=(240, 10),
                                     size=(70, 30))
        self._delete_button.SetBackgroundColour(Colour.RED)
        self._delete_button.SetForegroundColour(Colour.WHITE)

        self._list_control = ListBox(self, pos=(10, 50), size=(295, 170))
        self._list_control.SetBackgroundColour(Colour.BLACK)
        self._list_control.SetForegroundColour(Colour.WHITE)

        self._items = GlobalStorage.get_storage().get_items()
        self._list_control.SetItems(
            GlobalStorage.get_storage().get_string_list(self._items))

        self.Bind(EVT_BUTTON, self._back_button_click, self._back_button)
        self.Bind(EVT_BUTTON, self._delete_button_click, self._delete_button)
Exemple #29
0
 def __init__(self):
     """Constructor"""
     Dialog.__init__(self, None, title="Bad Cop", size=Size(500, 100))
     ico = Icon('logo.ico', BITMAP_TYPE_ICO)
     self.SetIcon(ico)
     self.message = StaticText(
         self, label="Click Profile, then insert device and click Test")
     self.profile = Button(self, label="Profile")
     self.test = Button(self, label="Test")
     self.test.Disable()
     self.profile.Bind(EVT_BUTTON, self.profileusb)
     self.test.Bind(EVT_BUTTON, self.testusb)
     self.Bind(EVT_CLOSE, self.onclose)
     main_sizer = BoxSizer(VERTICAL)
     t_sizer = BoxSizer(HORIZONTAL)
     p_sizer = BoxSizer(HORIZONTAL)
     t_sizer.Add(self.message, 0, ALL | CENTER, 5)
     p_sizer.Add(self.profile, 0, ALL | CENTER, 5)
     p_sizer.Add(self.test, 0, ALL | CENTER, 5)
     main_sizer.Add(p_sizer, 0, ALL | CENTER, 5)
     main_sizer.Add(t_sizer, 0, ALL | EXPAND | CENTER, 5)
     self.SetSizer(main_sizer)
Exemple #30
0
    def _createMethodsUIArtifacts(self) -> BoxSizer:

        self._lblMethod = StaticText(self, ID_ANY, _("Methods:"))

        self._lstMethodList: ListBox = ListBox(self,
                                               ID_LST_METHOD_LIST,
                                               choices=[],
                                               style=LB_SINGLE)
        self.Bind(EVT_LISTBOX, self._evtMethodList, id=ID_LST_METHOD_LIST)
        self.Bind(EVT_LISTBOX_DCLICK,
                  self._evtMethodListDClick,
                  id=ID_LST_METHOD_LIST)

        # Button Add
        self._btnMethodAdd = Button(self, ID_BTN_METHOD_ADD, _("A&dd"))
        self.Bind(EVT_BUTTON, self._onMethodAdd, id=ID_BTN_METHOD_ADD)

        # Button Edit
        self._btnMethodEdit = Button(self, ID_BTN_METHOD_EDIT, _("Ed&it"))
        self.Bind(EVT_BUTTON, self._onMethodEdit, id=ID_BTN_METHOD_EDIT)

        # Button Remove
        self._btnMethodRemove = Button(self, ID_BTN_METHOD_REMOVE,
                                       _("Re&move"))
        self.Bind(EVT_BUTTON, self._onMethodRemove, id=ID_BTN_METHOD_REMOVE)

        # Button Up
        self._btnMethodUp = Button(self, ID_BTN_METHOD_UP, _("U&p"))
        self.Bind(EVT_BUTTON, self._onMethodUp, id=ID_BTN_METHOD_UP)

        # Button Down
        self._btnMethodDown = Button(self, ID_BTN_METHOD_DOWN, _("Do&wn"))
        self.Bind(EVT_BUTTON, self._onMethodDown, id=ID_BTN_METHOD_DOWN)

        # Sizer for Methods buttons
        szrMethodButtons: BoxSizer = BoxSizer(HORIZONTAL)

        szrMethodButtons.Add(self._btnMethodAdd, 0, ALL, 5)
        szrMethodButtons.Add(self._btnMethodEdit, 0, ALL, 5)
        szrMethodButtons.Add(self._btnMethodRemove, 0, ALL, 5)
        szrMethodButtons.Add(self._btnMethodUp, 0, ALL, 5)
        szrMethodButtons.Add(self._btnMethodDown, 0, ALL, 5)

        return szrMethodButtons