Exemplo n.º 1
0
    def layoutControls(self):

        # create controls
        statictextCommand = wx.StaticText(self, ID_TEXT_COMMAND, "Command", wx.DefaultPosition, wx.DefaultSize, 0)
        self.commandtextctrl = wx.TextCtrl(self, ID_TEXTCTRL_COMMAND, "",
                                            wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE,
                                            validator=APDUHexValidator())
        statictextResponse = wx.StaticText(self, ID_TEXT_RESPONSE, "Response", wx.DefaultPosition, wx.DefaultSize, 0)
        self.responsetextctrl = wx.TextCtrl(self, ID_TEXTCTRL_RESPONSE, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY)
        statictextStatusWords = wx.StaticText(self, ID_TEXT_SW, "Status Words", wx.DefaultPosition, wx.DefaultSize, 0)
        statictextSW1 = wx.StaticText(self, ID_TEXT_SW1, "SW1", wx.DefaultPosition, wx.DefaultSize, 0)
        self.SW1textctrl = wx.TextCtrl(self, ID_TEXTCTRL_SW1, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_READONLY)
        statictextSW2 = wx.StaticText(self, ID_TEXT_SW2, "SW2", wx.DefaultPosition, wx.DefaultSize, 0)
        self.SW2textctrl = wx.TextCtrl(self, ID_TEXTCTRL_SW2, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_READONLY)
        self.feedbacktext = wx.StaticText(self, ID_CARDSTATE, "", wx.DefaultPosition, wx.DefaultSize, 0)

        # layout controls
        boxsizerCommand = wx.BoxSizer(wx.HORIZONTAL)
        boxsizerCommand.Add(statictextCommand, 1, wx.ALIGN_CENTER | wx.ALL, 5)
        boxsizerCommand.Add(self.commandtextctrl, 5, wx.EXPAND | wx.ALL, 5)

        boxsizerResponse = wx.BoxSizer(wx.HORIZONTAL)
        boxsizerResponse.Add(statictextResponse, 1, wx.ALIGN_CENTER | wx.ALL, 5)
        boxsizerResponse.Add(self.responsetextctrl, 5, wx.EXPAND | wx.ALL, 5)

        boxsizerSW = wx.BoxSizer(wx.HORIZONTAL)
        boxsizerSW.Add(statictextSW1, 0, wx.ALIGN_CENTER | wx.ALL, 5)
        boxsizerSW.Add(self.SW1textctrl, 0, wx.EXPAND | wx.ALL, 5)
        boxsizerSW.Add(statictextSW2, 0, wx.ALIGN_CENTER | wx.ALL, 5)
        boxsizerSW.Add(self.SW2textctrl, 0, wx.EXPAND | wx.ALL, 5)

        item11 = wx.BoxSizer(wx.HORIZONTAL)
        item11.Add(statictextStatusWords, 0, wx.ALIGN_CENTER | wx.ALL, 5)
        item11.Add(boxsizerSW, 0, wx.EXPAND | wx.ALL, 5)

        boxsizerResponseAndSW = wx.BoxSizer(wx.VERTICAL)
        boxsizerResponseAndSW.Add(boxsizerResponse, 0, wx.EXPAND | wx.ALL, 5)
        boxsizerResponseAndSW.Add(item11, 0, wx.EXPAND | wx.ALL, 5)

        staticboxAPDU = wx.StaticBox(self, -1, "APDU")
        boxsizerAPDU = wx.StaticBoxSizer(staticboxAPDU, wx.VERTICAL)
        boxsizerAPDU.Add(boxsizerCommand, 1, wx.EXPAND | wx.ALL, 5)
        boxsizerAPDU.Add(boxsizerResponseAndSW, 4, wx.EXPAND | wx.ALL, 5)

        staticboxEvents = wx.StaticBox(self, -1, "Card/Reader Events")
        boxsizerEvents = wx.StaticBoxSizer(staticboxEvents, wx.HORIZONTAL)
        boxsizerEvents.Add(self.feedbacktext, 0, wx.ALIGN_CENTER | wx.ALL, 5)


        sizerboxTransmitButton = wx.BoxSizer(wx.HORIZONTAL)
        sizerboxTransmitButton.Add([20, 20], 0, wx.ALIGN_CENTER | wx.ALL, 5)
        self.transmitbutton = wx.Button(self, ID_TRANSMIT, "Transmit", wx.DefaultPosition, wx.DefaultSize, 0)
        self.transmitbutton.Disable()
        sizerboxTransmitButton.Add(self.transmitbutton, 0, wx.ALIGN_CENTER | wx.ALL, 5)
        sizerboxTransmitButton.Add([20, 20], 0, wx.ALIGN_CENTER | wx.ALL, 5)

        sizerPanel = wx.BoxSizer(wx.VERTICAL)
        sizerPanel.Add(boxsizerAPDU, 3, wx.EXPAND | wx.ALL, 5)
        sizerPanel.Add(boxsizerEvents, 1, wx.EXPAND | wx.ALL, 5)
        sizerPanel.Add(sizerboxTransmitButton, 1, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(sizerPanel)
        self.SetAutoLayout(True)
        sizerPanel.Fit(self)
Exemplo n.º 2
0
    def _advancedSettsPage(self):
        """Create advanced settings page
        """
        #TODO parse maxcol, maxrow, settings from d.wms module?
        #TODO OnEarth driver - add selection of time
        adv_setts_panel = wx.Panel(parent = self, id = wx.ID_ANY)
        self.notebook.AddPage(page = adv_setts_panel,
                              text=_('Advanced request settings'),
                              name = 'adv_req_setts')

        labels = {}
        self.l_odrder_list = None
        if 'WMS' in self.ws:
            labels['l_order'] = wx.StaticBox(parent = adv_setts_panel, id = wx.ID_ANY,
                                             label = _("Order of layers in raster"))
            self.l_odrder_list = wx.ListBox(adv_setts_panel, id = wx.ID_ANY, choices = [],
                                                                style = wx.LB_SINGLE|wx.LB_NEEDED_SB)
            self.btnUp = wx.Button(adv_setts_panel, id = wx.ID_ANY, label = _("Up"))
            self.btnDown = wx.Button(adv_setts_panel, id = wx.ID_ANY, label = _("Down"))

            self.btnUp.Bind(wx.EVT_BUTTON, self.OnUp)
            self.btnDown.Bind(wx.EVT_BUTTON, self.OnDown)

        labels['method'] = wx.StaticText(parent = adv_setts_panel, id = wx.ID_ANY,
                                         label = _("Reprojection method:"))

        self.reproj_methods = ['nearest', 'linear', 'cubic', 'cubicspline']
        self.params['method'] = wx.Choice(parent = adv_setts_panel, id = wx.ID_ANY,
                                          choices = [_('Nearest neighbor'), _('Linear interpolation'),
                                                     _('Cubic interpolation'), _('Cubic spline interpolation')])

        labels['maxcols'] = wx.StaticText(parent = adv_setts_panel, id = wx.ID_ANY,
                                          label = _("Maximum columns to request from server at time:"))
        self.params['maxcols'] = wx.SpinCtrl(parent = adv_setts_panel, id = wx.ID_ANY, size = (100, -1))

        labels['maxrows'] = wx.StaticText(parent = adv_setts_panel, id = wx.ID_ANY,
                                          label = _("Maximum rows to request from server at time:"))
        self.params['maxrows'] = wx.SpinCtrl(parent = adv_setts_panel, id = wx.ID_ANY, size = (100, -1))

        min = 100
        max = 10000
        self.params['maxcols'].SetRange(min,max)
        self.params['maxrows'].SetRange(min,max)

        val = 500
        self.params['maxcols'].SetValue(val)
        self.params['maxrows'].SetValue(val)

        self.flags['o'] = self.params['bgcolor'] = None
        if not 'o' in self.drv_props['ignored_flags']:
            self.flags['o']  = wx.CheckBox(parent = adv_setts_panel, id = wx.ID_ANY,
                                           label = _("Do not request transparent data"))

            self.flags['o'].Bind(wx.EVT_CHECKBOX, self.OnTransparent)
            labels['bgcolor'] = wx.StaticText(parent = adv_setts_panel, id = wx.ID_ANY,
                                              label = _("Background color:"))
            self.params['bgcolor'] = csel.ColourSelect(parent = adv_setts_panel, id = wx.ID_ANY,
                                                       colour = (255, 255, 255),
                                                       size = globalvar.DIALOG_COLOR_SIZE)
            self.params['bgcolor'].Enable(False)

        self.params['urlparams'] = None
        if self.params['urlparams'] not in self.drv_props['ignored_params']:
            labels['urlparams'] = wx.StaticText(parent = adv_setts_panel, id = wx.ID_ANY,
                                                label = _("Additional query parameters for server:"))
            self.params['urlparams'] = wx.TextCtrl(parent = adv_setts_panel, id = wx.ID_ANY)

        # layout

        border = wx.BoxSizer(wx.VERTICAL)

        if 'WMS' in self.ws:

            boxSizer = wx.StaticBoxSizer(labels['l_order'], wx.VERTICAL)
            gridSizer  =  wx.GridBagSizer (hgap = 3, vgap = 3)

            gridSizer.Add(self.l_odrder_list,
                          pos = (0,0),
                          span = (4, 1),
                          flag = wx.ALIGN_CENTER_VERTICAL|wx.EXPAND,
                          border = 0)

            gridSizer.Add(self.btnUp,
                          pos = (0,1),
                          flag = wx.ALIGN_CENTER_VERTICAL,
                          border = 0)

            gridSizer.Add(self.btnDown,
                          pos = (1,1),
                          flag = wx.ALIGN_CENTER_VERTICAL,
                          border = 0)

            gridSizer.AddGrowableCol(0)
            boxSizer.Add(gridSizer,
                         flag = wx.EXPAND | wx.ALL,
                         border = 5)

            border.Add(item = boxSizer,
                       flag = wx.LEFT | wx.RIGHT | wx.UP | wx.EXPAND,
                       border = 5)

        gridSizer  =  wx.GridBagSizer (hgap = 3, vgap = 3)

        row = 0
        for k in ['method', 'maxcols', 'maxrows', 'o', 'bgcolor']:

            if self.params.has_key(k):
                param = self.params[k]
            elif self.flags.has_key(k):
                param = self.flags[k]

            if param is None:
                continue

            if labels.has_key(k) or k == 'o':
                if k != 'o':
                    label = labels[k]
                else:
                    label = param

                gridSizer.Add(label,
                              flag = wx.ALIGN_LEFT |
                              wx.ALIGN_CENTER_VERTICAL,
                              pos = (row, 0))

            if k != 'o':
                gridSizer.Add(item = param,
                              flag = wx.ALIGN_RIGHT |
                              wx.ALIGN_CENTER_VERTICAL,
                              pos = (row, 1))
            row += 1

        gridSizer.AddGrowableCol(0)
        border.Add(item = gridSizer,
                   flag = wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND,
                   border = 5)

        if self.params['urlparams']:
            gridSizer  =  wx.GridBagSizer (hgap = 3, vgap = 3)
            gridSizer.AddGrowableCol(1)

            row = 0
            gridSizer.Add(labels['urlparams'],
                          flag = wx.ALIGN_LEFT |
                          wx.ALIGN_CENTER_VERTICAL,
                          pos = (row, 0))

            gridSizer.Add(item = self.params['urlparams'],
                          flag = wx.ALIGN_RIGHT |
                          wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                          pos = (row, 1))

            border.Add(item = gridSizer,
                       flag = wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND,
                       border = 5)

        adv_setts_panel.SetSizer(border)
Exemplo n.º 3
0
    def __init__(self, parent, userdata):
        wx.Panel.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          pos=wx.DefaultPosition,
                          size=wx.Size(597, 764),
                          style=wx.TAB_TRAVERSAL)

        self.userdata = userdata

        container = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText17 = wx.StaticText(self, wx.ID_ANY, u"My Profile",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            wx.ALIGN_CENTRE)
        self.m_staticText17.Wrap(-1)
        self.m_staticText17.SetFont(
            wx.Font(14, 70, 90, 92, False, wx.EmptyString))

        container.Add(self.m_staticText17, 0,
                      wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 30)

        bSizer27 = wx.BoxSizer(wx.HORIZONTAL)

        left_spacer = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText30 = wx.StaticText(self, wx.ID_ANY, wx.EmptyString,
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText30.Wrap(-1)
        left_spacer.Add(self.m_staticText30, 0, wx.ALL, 5)

        bSizer27.Add(left_spacer, 1, wx.EXPAND, 5)

        form_sizer = wx.BoxSizer(wx.VERTICAL)

        sbSizer2 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"My Details"), wx.VERTICAL)

        user_id_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.user_id = wx.TextCtrl(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                   wx.EmptyString, wx.DefaultPosition,
                                   wx.DefaultSize, 0)
        self.user_id.Hide()

        user_id_sizer.Add(self.user_id, 3, wx.ALL, 5)

        sbSizer2.Add(user_id_sizer, 1, wx.EXPAND, 5)

        fname_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText29 = wx.StaticText(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                            u"First Name", wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.m_staticText29.Wrap(-1)
        self.m_staticText29.SetFont(
            wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False,
                    wx.EmptyString))

        fname_sizer.Add(self.m_staticText29, 1, wx.ALL, 10)

        self.first_name = wx.TextCtrl(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                      wx.EmptyString, wx.DefaultPosition,
                                      wx.DefaultSize, 0)
        fname_sizer.Add(self.first_name, 3, wx.ALL, 5)

        sbSizer2.Add(fname_sizer, 1, wx.ALL | wx.EXPAND | wx.TOP, 10)

        lname_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText292 = wx.StaticText(sbSizer2.GetStaticBox(),
                                             wx.ID_ANY, u"Last Name",
                                             wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.m_staticText292.Wrap(-1)
        self.m_staticText292.SetFont(
            wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False,
                    wx.EmptyString))

        lname_sizer.Add(self.m_staticText292, 1, wx.ALL, 10)

        self.last_name = wx.TextCtrl(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                     wx.EmptyString, wx.DefaultPosition,
                                     wx.DefaultSize, 0)
        lname_sizer.Add(self.last_name, 3, wx.ALL, 5)

        sbSizer2.Add(lname_sizer, 1, wx.ALL | wx.EXPAND, 10)

        surname_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText293 = wx.StaticText(sbSizer2.GetStaticBox(),
                                             wx.ID_ANY, u"Surname",
                                             wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.m_staticText293.Wrap(-1)
        self.m_staticText293.SetFont(
            wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False,
                    wx.EmptyString))

        surname_sizer.Add(self.m_staticText293, 1, wx.ALL, 10)

        self.surname = wx.TextCtrl(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                   wx.EmptyString, wx.DefaultPosition,
                                   wx.DefaultSize, 0)
        surname_sizer.Add(self.surname, 3, wx.ALL, 5)

        sbSizer2.Add(surname_sizer, 1, wx.ALL | wx.EXPAND, 10)

        email_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText = wx.StaticText(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                          u"Email Address", wx.DefaultPosition,
                                          wx.DefaultSize, 0)
        self.m_staticText.Wrap(-1)
        self.m_staticText.SetFont(
            wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False,
                    wx.EmptyString))

        email_sizer.Add(self.m_staticText, 1, wx.ALL, 10)

        self.email = wx.TextCtrl(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                 wx.EmptyString, wx.DefaultPosition,
                                 wx.DefaultSize, 0)
        email_sizer.Add(self.email, 3, wx.ALL, 5)

        sbSizer2.Add(email_sizer, 1, wx.ALL | wx.EXPAND, 10)

        dob_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText291 = wx.StaticText(sbSizer2.GetStaticBox(),
                                             wx.ID_ANY, u"Date of Birth",
                                             wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.m_staticText291.Wrap(-1)
        self.m_staticText291.SetFont(
            wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False,
                    wx.EmptyString))

        dob_sizer.Add(self.m_staticText291, 1, wx.ALL, 10)

        self.dob = wx.DatePickerCtrl(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                     wx.DefaultDateTime, wx.DefaultPosition,
                                     wx.DefaultSize,
                                     wx.DP_DEFAULT | wx.DP_DROPDOWN)
        dob_sizer.Add(self.dob, 3, wx.ALL, 5)

        sbSizer2.Add(dob_sizer, 1, wx.ALL | wx.EXPAND, 10)

        gender_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText294 = wx.StaticText(sbSizer2.GetStaticBox(),
                                             wx.ID_ANY, u"Gender",
                                             wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.m_staticText294.Wrap(-1)
        self.m_staticText294.SetFont(
            wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False,
                    wx.EmptyString))

        gender_sizer.Add(self.m_staticText294, 1, wx.ALL, 10)

        genderChoices = [u"Male", u"Female"]
        self.gender = wx.ComboBox(sbSizer2.GetStaticBox(), wx.ID_ANY, u"Male",
                                  wx.DefaultPosition, wx.DefaultSize,
                                  genderChoices, wx.CB_READONLY)
        self.gender.SetSelection(0)
        gender_sizer.Add(self.gender, 3, wx.ALL, 5)

        sbSizer2.Add(gender_sizer, 1, wx.ALL | wx.EXPAND, 10)

        username_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText1 = wx.StaticText(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                           u"Username", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.m_staticText1.Wrap(-1)
        self.m_staticText1.SetFont(
            wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False,
                    wx.EmptyString))

        username_sizer.Add(self.m_staticText1, 1, wx.ALL, 10)

        self.username = wx.TextCtrl(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                    wx.EmptyString, wx.DefaultPosition,
                                    wx.DefaultSize, 0)
        username_sizer.Add(self.username, 3, wx.ALL, 5)

        sbSizer2.Add(username_sizer, 1, wx.ALL | wx.EXPAND, 10)

        btns_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText22 = wx.StaticText(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                            wx.EmptyString, wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.m_staticText22.Wrap(-1)
        btns_sizer.Add(self.m_staticText22, 1, wx.ALL, 5)

        self.cancel_btn = wx.Button(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                    u"Cancel", wx.DefaultPosition,
                                    wx.DefaultSize, 0)
        self.cancel_btn.Hide()
        btns_sizer.Add(self.cancel_btn, 0, wx.ALL, 5)

        self.edit_btn = wx.Button(sbSizer2.GetStaticBox(), wx.ID_ANY, u"Edit",
                                  wx.DefaultPosition, wx.DefaultSize, 0)
        btns_sizer.Add(self.edit_btn, 0, wx.ALL, 5)

        self.save_edit = wx.Button(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                   u"Submit", wx.DefaultPosition,
                                   wx.DefaultSize, 0)
        self.save_edit.Hide()
        btns_sizer.Add(self.save_edit, 0, wx.ALL, 5)

        sbSizer2.Add(btns_sizer, 3, wx.ALL | wx.EXPAND, 10)

        form_sizer.Add(sbSizer2, 1, wx.EXPAND, 5)

        self.m_staticText301 = wx.StaticText(self, wx.ID_ANY, wx.EmptyString,
                                             wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.m_staticText301.Wrap(-1)
        self.m_staticText301.SetFont(
            wx.Font(30, 70, 90, 90, False, wx.EmptyString))

        form_sizer.Add(self.m_staticText301, 0, wx.ALL | wx.EXPAND, 5)

        bSizer27.Add(form_sizer, 3, wx.EXPAND, 5)

        right_spacer = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText31 = wx.StaticText(self, wx.ID_ANY, wx.EmptyString,
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText31.Wrap(-1)
        right_spacer.Add(self.m_staticText31, 0, wx.ALL, 5)

        bSizer27.Add(right_spacer, 1, wx.EXPAND, 5)

        container.Add(bSizer27, 1, wx.EXPAND, 5)

        self.SetSizer(container)
        self.Layout()

        # Set the values of the textboxes
        self.user_id.SetValue(str(self.userdata['user_id']))
        self.first_name.SetValue(self.userdata['first_name'])
        self.last_name.SetValue(self.userdata['last_name'])
        self.surname.SetValue(self.userdata['surname'])
        self.email.SetValue(self.userdata['email'])
        self.username.SetValue(self.userdata['username'])

        if self.userdata['gender'] == "M":
            gen = "Male"
        else:
            gen = "Female"

        self.gender.SetValue(gen)

        # get wxPython datetime format
        day = self.userdata['dob'].day
        month = self.userdata['dob'].month
        year = self.userdata['dob'].year

        # -1 because the month counts from 0, whereas people count January as month #1.
        dateFormatted = wx.DateTimeFromDMY(day, month - 1, year)

        self.dob.SetValue(dateFormatted)

        # Disable edit
        self.first_name.Enable(False)
        self.last_name.Enable(False)
        self.surname.Enable(False)
        self.email.Enable(False)
        self.username.Enable(False)
        self.gender.Enable(False)
        self.dob.Enable(False)

        # Connect Events
        self.cancel_btn.Bind(wx.EVT_BUTTON, self.cancelEditProfile)
        self.edit_btn.Bind(wx.EVT_BUTTON, self.openEditForm)
        self.save_edit.Bind(wx.EVT_BUTTON, self.saveEditProfile)
Exemplo n.º 4
0
    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, title=u"口令破解小工具", pos=wx.DefaultPosition,
                          size=wx.Size(631, 350), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)

        bSizer1 = wx.BoxSizer(wx.VERTICAL)

        self.online_notebook = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_panel8 = wx.Panel(self.online_notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL)
        main_Sizer = wx.FlexGridSizer(7, 2, 0, 0)
        main_Sizer.SetFlexibleDirection(wx.BOTH)
        main_Sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        self.onliine_staticText = wx.StaticText(self.m_panel8, wx.ID_ANY, u"请输入以下信息", wx.DefaultPosition,
                                                wx.DefaultSize, 0)
        self.onliine_staticText.Wrap(-1)
        main_Sizer.Add(self.onliine_staticText, 0, wx.ALL, 5)

        self.sign_staticText = wx.StaticText(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.sign_staticText.Wrap(-1)
        main_Sizer.Add(self.sign_staticText, 0, wx.ALL, 5)

        self.ip_Text = wx.StaticText(self.m_panel8, wx.ID_ANY, u"IP地址:", wx.DefaultPosition, wx.DefaultSize, 0)
        self.ip_Text.Wrap(-1)
        main_Sizer.Add(self.ip_Text, 0, wx.ALL, 5)

        self.ip_textCtrl = wx.TextCtrl(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        main_Sizer.Add(self.ip_textCtrl, 0, wx.ALL, 5)

        self.port_Text = wx.StaticText(self.m_panel8, wx.ID_ANY, u"端口号:", wx.DefaultPosition, wx.DefaultSize, 0)
        self.port_Text.Wrap(-1)
        main_Sizer.Add(self.port_Text, 0, wx.ALL, 5)

        self.port_textCtrl = wx.TextCtrl(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,
                                         0)
        main_Sizer.Add(self.port_textCtrl, 0, wx.ALL, 5)

        self.usernaem_Text = wx.StaticText(self.m_panel8, wx.ID_ANY, u"用户名:", wx.DefaultPosition, wx.DefaultSize, 0)
        self.usernaem_Text.Wrap(-1)
        main_Sizer.Add(self.usernaem_Text, 0, wx.ALL, 5)

        self.username_textCtrl = wx.TextCtrl(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        main_Sizer.Add(self.username_textCtrl, 0, wx.ALL, 5)

        self.passwd_Text = wx.StaticText(self.m_panel8, wx.ID_ANY, u"密码:", wx.DefaultPosition, wx.DefaultSize, 0)
        self.passwd_Text.Wrap(-1)
        main_Sizer.Add(self.passwd_Text, 0, wx.ALL, 5)

        self.passwd_textCtrl = wx.TextCtrl(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,
                                           0)
        main_Sizer.Add(self.passwd_textCtrl, 0, wx.ALL, 5)

        self.m_staticText16 = wx.StaticText(self.m_panel8, wx.ID_ANY, u"字典文件", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText16.Wrap(-1)
        main_Sizer.Add(self.m_staticText16, 0, wx.ALL, 5)

        self.dict_dirPicker = wx.DirPickerCtrl(self.m_panel8, wx.ID_ANY, wx.EmptyString, u"Select a folder",
                                               wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE)
        main_Sizer.Add(self.dict_dirPicker, 0, wx.ALL, 5)

        self.sign_staticText12 = wx.StaticText(self.m_panel8, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
                                               wx.DefaultSize, 0)
        self.sign_staticText12.Wrap(-1)
        main_Sizer.Add(self.sign_staticText12, 0, wx.ALL, 5)

        self.online_start_button = wx.Button(self.m_panel8, wx.ID_ANY, u"开始", wx.DefaultPosition, wx.DefaultSize, 0)
        main_Sizer.Add(self.online_start_button, 0, wx.ALL, 5)
        self.Bind(wx.EVT_BUTTON, self.online_check_linux, self.online_start_button)

        self.m_panel8.SetSizer(main_Sizer)
        self.m_panel8.Layout()
        main_Sizer.Fit(self.m_panel8)
        self.online_notebook.AddPage(self.m_panel8, u"在线检测", True)
        self.m_panel9 = wx.Panel(self.online_notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL)
        fgSizer2 = wx.FlexGridSizer(4, 2, 0, 0)
        fgSizer2.SetFlexibleDirection(wx.BOTH)
        fgSizer2.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        self.sign_staticText = wx.StaticText(self.m_panel9, wx.ID_ANY, u"请输入以下信息", wx.DefaultPosition, wx.DefaultSize,
                                             0)
        self.sign_staticText.Wrap(-1)
        fgSizer2.Add(self.sign_staticText, 0, wx.ALL, 5)

        self.sign_staticText9 = wx.StaticText(self.m_panel9, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
                                              wx.DefaultSize, 0)
        self.sign_staticText9.Wrap(-1)
        fgSizer2.Add(self.sign_staticText9, 0, wx.ALL, 5)

        self.passwd_path_Text = wx.StaticText(self.m_panel9, wx.ID_ANY, u"密码文件", wx.DefaultPosition, wx.DefaultSize, 0)
        self.passwd_path_Text.Wrap(-1)
        fgSizer2.Add(self.passwd_path_Text, 0, wx.ALL, 5)

        self.passwd_dirPicker = wx.DirPickerCtrl(self.m_panel9, wx.ID_ANY, wx.EmptyString, u"Select a folder",
                                             wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE)
        fgSizer2.Add(self.passwd_dirPicker, 0, wx.ALL, 5)

        self.dict_path_Text = wx.StaticText(self.m_panel9, wx.ID_ANY, u"字典文件", wx.DefaultPosition, wx.DefaultSize, 0)
        self.dict_path_Text.Wrap(-1)
        fgSizer2.Add(self.dict_path_Text, 0, wx.ALL, 5)

        self.dict_path_dirPicker = wx.DirPickerCtrl(self.m_panel9, wx.ID_ANY, wx.EmptyString, u"Select a folder",
                                             wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE)
        fgSizer2.Add(self.dict_path_dirPicker, 0, wx.ALL, 5)

        self.sign_staticText13 = wx.StaticText(self.m_panel9, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
                                               wx.DefaultSize, 0)
        self.sign_staticText13.Wrap(-1)
        fgSizer2.Add(self.sign_staticText13, 0, wx.ALL, 5)

        self.offline_start_button = wx.Button(self.m_panel9, wx.ID_ANY, u"开始", wx.DefaultPosition, wx.DefaultSize, 0)
        fgSizer2.Add(self.offline_start_button, 0, wx.ALL, 5)
        self.Bind(wx.EVT_BUTTON, self.offline_check_linux, self.offline_start_button)

        self.m_panel9.SetSizer(fgSizer2)
        self.m_panel9.Layout()
        fgSizer2.Fit(self.m_panel9)
        self.online_notebook.AddPage(self.m_panel9, u"离线检测", False)
        self.m_panel10 = wx.Panel(self.online_notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL)
        gSizer7 = wx.GridSizer(2, 2, 0, 0)

        sbSizer1 = wx.StaticBoxSizer(wx.StaticBox(self.m_panel10, wx.ID_ANY, u"在线批量"), wx.VERTICAL)

        fgSizer10 = wx.FlexGridSizer(2, 2, 0, 0)
        fgSizer10.SetFlexibleDirection(wx.BOTH)
        fgSizer10.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        self.policy_staticText17 = wx.StaticText(self.m_panel10, wx.ID_ANY, u"配置文件", wx.DefaultPosition, wx.DefaultSize,
                                                 0)
        self.policy_staticText17.Wrap(-1)
        fgSizer10.Add(self.policy_staticText17, 0, wx.ALL, 5)

        self.policy_online_dirPicker = wx.DirPickerCtrl(self.m_panel10, wx.ID_ANY, wx.EmptyString, u"Select a folder",
                                                        wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE)
        fgSizer10.Add(self.policy_online_dirPicker, 0, wx.ALL, 5)

        self.m_staticText17 = wx.StaticText(self.m_panel10, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.m_staticText17.Wrap(-1)
        fgSizer10.Add(self.m_staticText17, 0, wx.ALL, 5)

        self.online_batch_button = wx.Button(self.m_panel10, wx.ID_ANY, u"开始", wx.DefaultPosition, wx.DefaultSize, 0)
        fgSizer10.Add(self.online_batch_button, 0, wx.ALL, 5)

        sbSizer1.Add(fgSizer10, 1, wx.EXPAND, 5)

        gSizer7.Add(sbSizer1, 1, wx.EXPAND, 5)

        sbSizer3 = wx.StaticBoxSizer(wx.StaticBox(self.m_panel10, wx.ID_ANY, u"离线批量"), wx.VERTICAL)

        fgSizer11 = wx.FlexGridSizer(2, 2, 0, 0)
        fgSizer11.SetFlexibleDirection(wx.BOTH)
        fgSizer11.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        self.m_staticText18 = wx.StaticText(self.m_panel10, wx.ID_ANY, u"文件路径", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText18.Wrap(-1)
        fgSizer11.Add(self.m_staticText18, 0, wx.ALL, 5)

        self.policy_offline_dirPicker = wx.DirPickerCtrl(self.m_panel10, wx.ID_ANY, wx.EmptyString, u"Select a folder",
                                                         wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE)
        fgSizer11.Add(self.policy_offline_dirPicker, 0, wx.ALL, 5)

        self.m_staticText181 = wx.StaticText(self.m_panel10, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.m_staticText181.Wrap(-1)
        fgSizer11.Add(self.m_staticText181, 0, wx.ALL, 5)

        self.offline_batch_button = wx.Button(self.m_panel10, wx.ID_ANY, u"开始", wx.DefaultPosition, wx.DefaultSize, 0)
        fgSizer11.Add(self.offline_batch_button, 0, wx.ALL, 5)

        sbSizer3.Add(fgSizer11, 1, wx.EXPAND, 5)

        gSizer10 = wx.GridSizer(1, 1, 0, 0)

        self.m_staticText20 = wx.StaticText(self.m_panel10, wx.ID_ANY, u"离线批量检测:检测文件格式为父目录。", wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.m_staticText20.Wrap(-1)
        gSizer10.Add(self.m_staticText20, 0, wx.ALL | wx.EXPAND, 5)

        sbSizer3.Add(gSizer10, 1, wx.EXPAND, 5)

        gSizer7.Add(sbSizer3, 1, wx.EXPAND, 5)

        self.m_panel10.SetSizer(gSizer7)
        self.m_panel10.Layout()
        gSizer7.Fit(self.m_panel10)
        self.online_notebook.AddPage(self.m_panel10, u"批量检测", True)

        bSizer1.Add(self.online_notebook, 1, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(bSizer1)
        self.Layout()
def set_data_con_gui(parent, scroll, szr, lblfont, *, read_only=False):
    bx_msaccess = wx.StaticBox(scroll, -1, "MS Access")
    ## default database
    parent.lbl_msaccess_default_db = wx.StaticText(
        scroll, -1, _("Default Database - name only e.g. demo.mdb:"))
    parent.lbl_msaccess_default_db.SetFont(lblfont)
    MSACCESS_DEFAULT_DB = (parent.msaccess_default_db
                           if parent.msaccess_default_db else '')
    parent.txt_msaccess_default_db = wx.TextCtrl(scroll,
                                                 -1,
                                                 MSACCESS_DEFAULT_DB,
                                                 size=(250, -1))
    parent.txt_msaccess_default_db.Enable(not read_only)
    parent.txt_msaccess_default_db.SetToolTip(_("Default database (optional)"))
    ## default table
    parent.lbl_msaccess_default_tbl = wx.StaticText(scroll, -1,
                                                    _("Default Table:"))
    parent.lbl_msaccess_default_tbl.SetFont(lblfont)
    MSACCESS_DEFAULT_TBL = (parent.msaccess_default_tbl
                            if parent.msaccess_default_tbl else '')
    parent.txt_msaccess_default_tbl = wx.TextCtrl(scroll,
                                                  -1,
                                                  MSACCESS_DEFAULT_TBL,
                                                  size=(250, -1))
    parent.txt_msaccess_default_tbl.Enable(not read_only)
    parent.txt_msaccess_default_tbl.SetToolTip(_("Default table (optional)"))
    parent.szr_msaccess = wx.StaticBoxSizer(bx_msaccess, wx.VERTICAL)
    ## 3 MS ACCESS INNER
    szr_msaccess_inner = wx.BoxSizer(wx.HORIZONTAL)
    szr_msaccess_inner.Add(parent.lbl_msaccess_default_db, 0,
                           wx.LEFT | wx.RIGHT, 5)
    szr_msaccess_inner.Add(parent.txt_msaccess_default_db, 1,
                           wx.GROW | wx.RIGHT, 10)
    szr_msaccess_inner.Add(parent.lbl_msaccess_default_tbl, 0,
                           wx.LEFT | wx.RIGHT, 5)
    szr_msaccess_inner.Add(parent.txt_msaccess_default_tbl, 1,
                           wx.GROW | wx.RIGHT, 10)
    parent.szr_msaccess.Add(szr_msaccess_inner, 0)
    col_det_db = {
        'col_label': _('Database(s)'),
        'coltype': settings_grid.COL_TEXT_BROWSE,
        'colwidth': 250,
        'file_phrase': _('Choose an MS Access database file'),
        'file_wildcard': _('MS Access databases') + ' (*.mdb)|*.mdb',
        'empty_ok': False
    }
    col_det_sec = {
        'col_label': _('Security File') + ' (*.mdw) (opt)',
        'coltype': settings_grid.COL_TEXT_BROWSE,
        'colwidth': 250,
        'file_phrase': _('Choose an MS Access security file'),
        'file_wildcard': _('MS Access security files (*.mdw)|*.mdw'),
        'empty_ok': True
    }
    col_det_usr = {
        'col_label': _('User Name (opt)'),
        'coltype': settings_grid.COL_STR,
        'colwidth': 130,
        'file_phrase': None,
        'file_wildcard': None,
        'empty_ok': True
    }
    col_det_pwd = {
        'col_label': _('Password (opt)'),
        'coltype': settings_grid.COL_PWD,
        'colwidth': 130,
        'file_phrase': None,
        'file_wildcard': None,
        'empty_ok': True
    }
    msaccess_col_dets = [col_det_db, col_det_sec, col_det_usr, col_det_pwd]
    parent.msaccess_settings_data = []
    init_settings_data = parent.msaccess_data[:]
    init_settings_data.sort(key=lambda s: s[0])
    parent.msaccess_grid = settings_grid.SettingsEntry(
        frame=parent,
        panel=scroll,
        grid_size=(900, 100),
        col_dets=msaccess_col_dets,
        init_settings_data=init_settings_data,
        settings_data=parent.msaccess_settings_data,
        read_only=read_only,
        force_focus=True)
    parent.szr_msaccess.Add(parent.msaccess_grid.grid, 1, wx.GROW | wx.ALL, 5)
    szr.Add(parent.szr_msaccess, 0, wx.GROW | wx.ALL, 10)
Exemplo n.º 6
0
	def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Bead Pattern Generator v1.0", pos = wx.DefaultPosition, size = wx.Size( 780,550 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
		
		self.SetSizeHintsSz( wx.Size( 600,400 ), wx.DefaultSize )
		
		bSizer1 = wx.BoxSizer( wx.VERTICAL )
		
		self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		bSizer2 = wx.BoxSizer( wx.VERTICAL )
		
		bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.m_panel3 = wx.Panel( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		self.m_panel3.SetMinSize( wx.Size( 300,-1 ) )
		self.m_panel3.SetMaxSize( wx.Size( 300,-1 ) )
		
		bSizer4 = wx.BoxSizer( wx.VERTICAL )
		
		sbSizer2 = wx.StaticBoxSizer( wx.StaticBox( self.m_panel3, wx.ID_ANY, u"Image File" ), wx.VERTICAL )
		
		self.m_filePicker1 = wx.FilePickerCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.gif; *.jpg; *.jpeg; *.png", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE )
		sbSizer2.Add( self.m_filePicker1, 0, wx.ALL|wx.EXPAND, 5 )
		
		bSizer4.Add( sbSizer2, 0, wx.ALL|wx.EXPAND, 5 )
		
		sbSizer21 = wx.StaticBoxSizer( wx.StaticBox( self.m_panel3, wx.ID_ANY, u"Bead Options" ), wx.HORIZONTAL )
		
		bSizer8 = wx.BoxSizer( wx.VERTICAL )
		
		self.m_cb_hama = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"Hama", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_cb_hama.SetValue(True) 
		bSizer8.Add( self.m_cb_hama, 0, wx.ALL, 5 )
		
		self.m_cb_perler = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"Perler", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer8.Add( self.m_cb_perler, 0, wx.ALL, 5 )
		
		self.m_cb_nabbi = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"Nabbi", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer8.Add( self.m_cb_nabbi, 0, wx.ALL, 5 )
		
		self.m_cb_hobby = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"PictureBeads", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer8.Add( self.m_cb_hobby, 0, wx.ALL, 5 )
		
		sbSizer21.Add( bSizer8, 2, wx.ALL|wx.EXPAND, 5 )
		
		bSizer9 = wx.BoxSizer( wx.VERTICAL )
		
		self.m_cb_standard = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"Include Standard Beads", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_cb_standard.SetValue(True) 
		bSizer9.Add( self.m_cb_standard, 0, wx.ALL, 5 )
		
		self.m_cb_metal = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"Include Metalic Beads", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer9.Add( self.m_cb_metal, 0, wx.ALL, 5 )
		
		self.m_cb_glitter = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"Include Glitter Beads", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer9.Add( self.m_cb_glitter, 0, wx.ALL, 5 )
		
		self.m_cb_neon = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"Include Neon Beads", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer9.Add( self.m_cb_neon, 0, wx.ALL, 5 )
		
		self.m_cb_trans = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"Include Translucent Beads", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer9.Add( self.m_cb_trans, 0, wx.ALL, 5 )
		
		self.m_cb_flour = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"Include Flourescent Beads", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer9.Add( self.m_cb_flour, 0, wx.ALL, 5 )
		
		self.m_cb_glow = wx.CheckBox( self.m_panel3, wx.ID_ANY, u"Glow in the Dark", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer9.Add( self.m_cb_glow, 0, wx.ALL, 5 )
		
		sbSizer21.Add( bSizer9, 3, wx.EXPAND, 5 )
		
		bSizer4.Add( sbSizer21, 1, wx.ALL|wx.EXPAND, 5 )
		
		bSizer13 = wx.BoxSizer( wx.VERTICAL )
		
		self.m_generate = wx.Button( self.m_panel3, wx.ID_ANY, u"Generate Design", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer13.Add( self.m_generate, 0, 0, 5 )
		
		bSizer4.Add( bSizer13, 0, wx.ALL|wx.EXPAND, 5 )
		
		self.m_panel3.SetSizer( bSizer4 )
		self.m_panel3.Layout()
		bSizer4.Fit( self.m_panel3 )
		bSizer3.Add( self.m_panel3, 0, wx.EXPAND, 5 )
		
		self.m_panel2 = wx.Panel( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		bSizer5 = wx.BoxSizer( wx.VERTICAL )
		
		sbSizer1 = wx.StaticBoxSizer( wx.StaticBox( self.m_panel2, wx.ID_ANY, u"Design View" ), wx.VERTICAL )
		
		self.previewPane = wx.BoxSizer( wx.VERTICAL )
		
		sbSizer1.Add( self.previewPane, 1, wx.EXPAND, 5 )
		
		bSizer5.Add( sbSizer1, 1, wx.ALL|wx.EXPAND, 5 )
		
		bSizer11 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.m_radioBtn3 = wx.RadioButton( self.m_panel2, wx.ID_ANY, u"Design View", wx.DefaultPosition, wx.DefaultSize, wx.RB_GROUP )
		self.m_radioBtn3.SetValue( True ) 
		bSizer11.Add( self.m_radioBtn3, 0, wx.ALL, 5 )
		
		self.m_radioBtn4 = wx.RadioButton( self.m_panel2, wx.ID_ANY, u"Materials View", wx.DefaultPosition, wx.DefaultSize, wx.RB_GROUP )
		bSizer11.Add( self.m_radioBtn4, 0, wx.ALL, 5 )
		
		bSizer5.Add( bSizer11, 0, wx.ALL|wx.EXPAND, 5 )
		
		self.m_panel2.SetSizer( bSizer5 )
		self.m_panel2.Layout()
		bSizer5.Fit( self.m_panel2 )
		bSizer3.Add( self.m_panel2, 1, wx.EXPAND, 5 )
		
		bSizer2.Add( bSizer3, 1, wx.EXPAND, 5 )
		
		self.m_panel1.SetSizer( bSizer2 )
		self.m_panel1.Layout()
		bSizer2.Fit( self.m_panel1 )
		bSizer1.Add( self.m_panel1, 1, wx.EXPAND, 5 )
		
		self.SetSizer( bSizer1 )
		self.Layout()
		self.m_menubar1 = wx.MenuBar( 0 )
		self.m_menu1 = wx.Menu()
		self.m_menuItem1 = wx.MenuItem( self.m_menu1, wx.ID_ANY, u"Load Image from File", wx.EmptyString, wx.ITEM_NORMAL )
		self.m_menu1.AppendItem( self.m_menuItem1 )
		
		self.m_menuItem2 = wx.MenuItem( self.m_menu1, wx.ID_ANY, u"Exit", wx.EmptyString, wx.ITEM_NORMAL )
		self.m_menu1.AppendItem( self.m_menuItem2 )
		
		self.m_menubar1.Append( self.m_menu1, u"File" ) 
		
		self.m_menu4 = wx.Menu()
		self.m_menuItem3 = wx.MenuItem( self.m_menu4, wx.ID_ANY, u"Generate Design", wx.EmptyString, wx.ITEM_NORMAL )
		self.m_menu4.AppendItem( self.m_menuItem3 )
		
		self.m_menubar1.Append( self.m_menu4, u"Generate" ) 
		
		self.m_menu5 = wx.Menu()
		self.m_menuItem4 = wx.MenuItem( self.m_menu5, wx.ID_ANY, u"Design View", wx.EmptyString, wx.ITEM_NORMAL )
		self.m_menu5.AppendItem( self.m_menuItem4 )
		
		self.m_menuItem5 = wx.MenuItem( self.m_menu5, wx.ID_ANY, u"Materials View", wx.EmptyString, wx.ITEM_NORMAL )
		self.m_menu5.AppendItem( self.m_menuItem5 )
		
		self.m_menubar1.Append( self.m_menu5, u"View" ) 
		
		self.m_menu6 = wx.Menu()
		self.m_menuItem6 = wx.MenuItem( self.m_menu6, wx.ID_ANY, u"About", wx.EmptyString, wx.ITEM_NORMAL )
		self.m_menu6.AppendItem( self.m_menuItem6 )
		
		self.m_menubar1.Append( self.m_menu6, u"Help" ) 
		
		self.SetMenuBar( self.m_menubar1 )
		
		
		self.Centre( wx.BOTH )
		
		# Connect Events
		self.m_filePicker1.Bind( wx.EVT_FILEPICKER_CHANGED, self.onImageSelect )
		self.m_generate.Bind( wx.EVT_BUTTON, self.onGenerate )
		self.Bind( wx.EVT_MENU, self.onLoadImage, id = self.m_menuItem1.GetId() )
		self.Bind( wx.EVT_MENU, self.onExit, id = self.m_menuItem2.GetId() )
		self.Bind( wx.EVT_MENU, self.onGenerate, id = self.m_menuItem3.GetId() )
		self.Bind( wx.EVT_MENU, self.onAbout, id = self.m_menuItem6.GetId() )
Exemplo n.º 7
0
    def _do_layout(self):
        """!Do layout"""
        # dialog layout
        sizer = wx.BoxSizer(wx.VERTICAL)

        box = wx.StaticBox(parent=self,
                           id=wx.ID_ANY,
                           label=" %s " % _("Text settings"))
        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)

        #
        # profile title
        #
        label = wx.StaticText(parent=self,
                              id=wx.ID_ANY,
                              label=_("Profile title:"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
        self.ptitleentry = wx.TextCtrl(parent=self,
                                       id=wx.ID_ANY,
                                       value="",
                                       size=(250, -1))
        # self.ptitleentry.SetFont(self.font)
        self.ptitleentry.SetValue(self.ptitle)
        gridSizer.Add(item=self.ptitleentry, pos=(0, 1))

        #
        # title font
        #
        tlabel = wx.StaticText(parent=self,
                               id=wx.ID_ANY,
                               label=_("Title font size (pts):"))
        gridSizer.Add(item=tlabel, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
        self.ptitlesize = wx.SpinCtrl(parent=self,
                                      id=wx.ID_ANY,
                                      value="",
                                      pos=(30, 50),
                                      size=(50, -1),
                                      style=wx.SP_ARROW_KEYS)
        self.ptitlesize.SetRange(5, 100)
        self.ptitlesize.SetValue(
            int(self.properties['font']['prop']['titleSize']))
        gridSizer.Add(item=self.ptitlesize, pos=(1, 1))

        #
        # x-axis label
        #
        label = wx.StaticText(parent=self,
                              id=wx.ID_ANY,
                              label=_("X-axis label:"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
        self.xlabelentry = wx.TextCtrl(parent=self,
                                       id=wx.ID_ANY,
                                       value="",
                                       size=(250, -1))
        # self.xlabelentry.SetFont(self.font)
        self.xlabelentry.SetValue(self.xlabel)
        gridSizer.Add(item=self.xlabelentry, pos=(2, 1))

        #
        # y-axis label
        #
        label = wx.StaticText(parent=self,
                              id=wx.ID_ANY,
                              label=_("Y-axis label:"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(3, 0))
        self.ylabelentry = wx.TextCtrl(parent=self,
                                       id=wx.ID_ANY,
                                       value="",
                                       size=(250, -1))
        # self.ylabelentry.SetFont(self.font)
        self.ylabelentry.SetValue(self.ylabel)
        gridSizer.Add(item=self.ylabelentry, pos=(3, 1))

        #
        # font size
        #
        llabel = wx.StaticText(parent=self,
                               id=wx.ID_ANY,
                               label=_("Label font size (pts):"))
        gridSizer.Add(item=llabel, flag=wx.ALIGN_CENTER_VERTICAL, pos=(4, 0))
        self.axislabelsize = wx.SpinCtrl(parent=self,
                                         id=wx.ID_ANY,
                                         value="",
                                         pos=(30, 50),
                                         size=(50, -1),
                                         style=wx.SP_ARROW_KEYS)
        self.axislabelsize.SetRange(5, 100)
        self.axislabelsize.SetValue(
            int(self.properties['font']['prop']['axisSize']))
        gridSizer.Add(item=self.axislabelsize, pos=(4, 1))

        boxSizer.Add(item=gridSizer)
        sizer.Add(item=boxSizer, flag=wx.ALL | wx.EXPAND, border=3)

        #
        # font settings
        #
        box = wx.StaticBox(parent=self,
                           id=wx.ID_ANY,
                           label=" %s " % _("Font settings"))
        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
        gridSizer.AddGrowableCol(1)

        #
        # font family
        #
        label1 = wx.StaticText(parent=self,
                               id=wx.ID_ANY,
                               label=_("Font family:"))
        gridSizer.Add(item=label1, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
        self.ffamilycb = wx.ComboBox(parent=self,
                                     id=wx.ID_ANY,
                                     size=(250, -1),
                                     choices=self.ffamilydict.keys(),
                                     style=wx.CB_DROPDOWN)
        self.ffamilycb.SetStringSelection('swiss')
        for item in self.ffamilydict.items():
            if self.fontfamily == item[1]:
                self.ffamilycb.SetStringSelection(item[0])
                break
        gridSizer.Add(item=self.ffamilycb, pos=(0, 1), flag=wx.ALIGN_RIGHT)

        #
        # font style
        #
        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Style:"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
        self.fstylecb = wx.ComboBox(parent=self,
                                    id=wx.ID_ANY,
                                    size=(250, -1),
                                    choices=self.fstyledict.keys(),
                                    style=wx.CB_DROPDOWN)
        self.fstylecb.SetStringSelection('normal')
        for item in self.fstyledict.items():
            if self.fontstyle == item[1]:
                self.fstylecb.SetStringSelection(item[0])
                break
        gridSizer.Add(item=self.fstylecb, pos=(1, 1), flag=wx.ALIGN_RIGHT)

        #
        # font weight
        #
        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Weight:"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
        self.fwtcb = wx.ComboBox(parent=self,
                                 size=(250, -1),
                                 choices=self.fwtdict.keys(),
                                 style=wx.CB_DROPDOWN)
        self.fwtcb.SetStringSelection('normal')
        for item in self.fwtdict.items():
            if self.fontweight == item[1]:
                self.fwtcb.SetStringSelection(item[0])
                break

        gridSizer.Add(item=self.fwtcb, pos=(2, 1), flag=wx.ALIGN_RIGHT)

        boxSizer.Add(item=gridSizer, flag=wx.EXPAND)
        sizer.Add(item=boxSizer,
                  flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
                  border=3)

        line = wx.StaticLine(parent=self,
                             id=wx.ID_ANY,
                             size=(20, -1),
                             style=wx.LI_HORIZONTAL)
        sizer.Add(item=line,
                  proportion=0,
                  flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                  border=3)

        #
        # buttons
        #
        btnSave = wx.Button(self, wx.ID_SAVE)
        btnApply = wx.Button(self, wx.ID_APPLY)
        btnOk = wx.Button(self, wx.ID_OK)
        btnCancel = wx.Button(self, wx.ID_CANCEL)
        btnOk.SetDefault()

        # bindings
        btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
        btnApply.SetToolTipString(_("Apply changes for the current session"))
        btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
        btnOk.SetToolTipString(
            _("Apply changes for the current session and close dialog"))
        btnOk.SetDefault()
        btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
        btnSave.SetToolTipString(
            _("Apply and save changes to user settings file (default for next sessions)"
              ))
        btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
        btnCancel.SetToolTipString(_("Close dialog and ignore changes"))

        # sizers
        btnStdSizer = wx.StdDialogButtonSizer()
        btnStdSizer.AddButton(btnOk)
        btnStdSizer.AddButton(btnApply)
        btnStdSizer.AddButton(btnCancel)
        btnStdSizer.Realize()

        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        btnSizer.Add(item=btnSave,
                     proportion=0,
                     flag=wx.ALIGN_LEFT | wx.ALL,
                     border=5)
        btnSizer.Add(item=btnStdSizer,
                     proportion=0,
                     flag=wx.ALIGN_RIGHT | wx.ALL,
                     border=5)
        sizer.Add(item=btnSizer,
                  proportion=0,
                  flag=wx.ALIGN_RIGHT | wx.ALL,
                  border=5)

        #
        # bindings
        #
        self.ptitleentry.Bind(wx.EVT_TEXT, self.OnTitle)
        self.xlabelentry.Bind(wx.EVT_TEXT, self.OnXLabel)
        self.ylabelentry.Bind(wx.EVT_TEXT, self.OnYLabel)

        self.SetSizer(sizer)
        sizer.Fit(self)
Exemplo n.º 8
0
    def __init__(self, parent, id):
        #---------------------------------------------------------------------------
        ExpertSettingPanel.__init__(self, parent, id)

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

        # ---------------- generic crossovers ----------------
        genericBox = wx.StaticBox(self,
                                  -1,
                                  "Generic operations",
                                  size=(500, -1))
        genericBoxSizer = wx.StaticBoxSizer(genericBox, wx.VERTICAL)
        genericFlexGridSizer = wx.FlexGridSizer(0, 2, 5, 5)
        genericBoxSizer.Add(genericFlexGridSizer, 0)
        sizer.Add(genericBoxSizer, 0, wx.ALL | wx.EXPAND, 10)

        # n point crossover (default: one point crossover)
        nPointSizer = wx.BoxSizer(wx.HORIZONTAL)
        genericBoxSizer.Add(nPointSizer, 0, wx.EXPAND)

        self.nPointCrossover = wx.CheckBox(self, -1, "N-Point crossover", \
            name = "nPointCrossover")
        genericFlexGridSizer.Add(self.nPointCrossover, 0, \
            wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND, 5)

        self.nPointCrossoverN = wx.SpinCtrl(self, -1, size=(100,-1), \
            min=1, max=10, value='1') # TODO: max = vector dimension
        self.nPointCrossoverN.Disable()
        self.nPointCrossoverN.SetToolTipString("num crossover points")
        genericFlexGridSizer.Add(self.nPointCrossoverN, 0,
                                 wx.LEFT | wx.TOP | wx.RIGHT, 5)

        self.genericWidgets.append(self.nPointCrossover)
        self.AddChildToParent(self.nPointCrossover, self.nPointCrossoverN)

        # uniform crossover
        self.uniformCrossover = wx.CheckBox(self, -1, "Uniform crossover", \
            name = "uniformCrossover")
        self.uniformCrossover.SetValue(True)
        genericFlexGridSizer.Add(self.uniformCrossover, 0, \
            wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND, 5)

        self.uniformCrossoverPref = FS.FloatSpin(self, -1, min_val=0.0, max_val=1.0, \
            increment=0.01, value=0.5)
        self.uniformCrossoverPref.SetFormat("%f")
        self.uniformCrossoverPref.SetDigits(2)
        self.uniformCrossoverPref.SetToolTipString("Preference")
        genericFlexGridSizer.Add(self.uniformCrossoverPref, 0,
                                 wx.LEFT | wx.TOP | wx.RIGHT, 5)

        self.genericWidgets.append(self.uniformCrossover)
        self.AddChildToParent(self.uniformCrossover, self.uniformCrossoverPref)

        # ---------------- real crossovers ----------------
        realBox = wx.StaticBox(
            self,
            -1,
            "Real operations (affects only feature weighting)",
            size=(500, -1))
        realBoxSizer = wx.StaticBoxSizer(realBox, wx.VERTICAL)
        realBoxFlexGridSizer = wx.FlexGridSizer(0, 2, 5, 5)
        realBoxSizer.Add(realBoxFlexGridSizer, 0)
        sizer.Add(realBoxSizer, 0, wx.ALL | wx.EXPAND, 10)

        # simulated binary crossover
        self.sbxCrossover = wx.CheckBox(self, -1, "SBX Crossover", \
            name = "SBXcrossover")
        self.sbxCrossover.SetValue(True)
        self.sbxCrossover.Disable()
        realBoxFlexGridSizer.Add(self.sbxCrossover, 0,
                                 wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND, 5)

        self.sbxCrossoverEta = FS.FloatSpin(self, -1, min_val=0.01, max_val=10.0, \
            increment=0.01, value=1.0)
        self.sbxCrossoverEta.SetFormat("%f")
        self.sbxCrossoverEta.SetDigits(2)
        self.sbxCrossoverEta.Disable()
        self.sbxCrossoverEta.SetToolTipString("eta the amount of exploration "\
            "OUTSIDE the parents in BLX-alpha notation")
        realBoxFlexGridSizer.Add(self.sbxCrossoverEta, 0,
                                 wx.LEFT | wx.TOP | wx.RIGHT, 5)

        self.weightingWidgets.append(self.sbxCrossover)
        self.AddChildToParent(self.sbxCrossover, self.sbxCrossoverEta)

        # segment crossover
        self.segmentCrossover = wx.CheckBox(self, -1, "Segment Crossover", \
            name = "segmentCrossover")
        self.segmentCrossover.Disable()
        realBoxFlexGridSizer.Add(self.segmentCrossover, 0,
                                 wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND, 5)

        self.segmentCrossoverAlpha = FS.FloatSpin(self, -1, min_val=0.01, max_val=10.0, \
            increment=0.01, value=1.0)
        self.segmentCrossoverAlpha.SetFormat("%f")
        self.segmentCrossoverAlpha.SetDigits(2)
        self.segmentCrossoverAlpha.Disable()
        self.segmentCrossoverAlpha.SetToolTipString("alpha the amount of exploration "\
            "OUTSIDE the parents in BLX-alpha notation")
        realBoxFlexGridSizer.Add(self.segmentCrossoverAlpha, 0,
                                 wx.LEFT | wx.TOP | wx.RIGHT, 5)

        self.weightingWidgets.append(self.segmentCrossover)
        self.AddChildToParent(self.segmentCrossover,
                              self.segmentCrossoverAlpha)

        # hypercube crossover
        self.hypercubeCrossover = wx.CheckBox(self, -1, "Hypercube Crossover", \
            name = "hypercubeCrossover")
        self.hypercubeCrossover.Disable()
        realBoxFlexGridSizer.Add(self.hypercubeCrossover, 0,
                                 wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND, 5)

        self.hypercubeCrossoverAlpha = FS.FloatSpin(self, -1, min_val=0.01, max_val=10.0, \
            increment=0.01, value=1.0)
        self.hypercubeCrossoverAlpha.SetFormat("%f")
        self.hypercubeCrossoverAlpha.SetDigits(2)
        self.hypercubeCrossoverAlpha.Disable()
        self.hypercubeCrossoverAlpha.SetToolTipString("alpha the amount of exploration "\
            "OUTSIDE the parents in BLX-alpha notation")
        realBoxFlexGridSizer.Add(self.hypercubeCrossoverAlpha, 0,
                                 wx.LEFT | wx.TOP | wx.RIGHT, 5)

        self.weightingWidgets.append(self.hypercubeCrossover)
        self.AddChildToParent(self.hypercubeCrossover,
                              self.hypercubeCrossoverAlpha)

        # bind the EVT_CHECKBOX to the CheckBoxes
        self.BindEvent(wx.EVT_CHECKBOX, self.OnCheckBox, \
            [self.nPointCrossover,
             self.uniformCrossover,
             self.sbxCrossover,
             self.segmentCrossover,
             self.hypercubeCrossover])
Exemplo n.º 9
0
    def __init__(self):
        wx.Frame.__init__(self, None, -1, "StaticBoxSizer Test")
        self.panel = wx.Panel(self)

        # # make three static boxes with windows positioned inside them
        # box1 = self.MakeStaticBoxSizer("Box 1", labels[0:3])
        # box2 = self.MakeStaticBoxSizer("Box 2", labels[3:6])
        # box3 = self.MakeStaticBoxSizer("Box 3", labels[6:9])
        #
        # # We can also use a sizer to manage the placement of other
        # # sizers (and therefore the windows and sub-sizers that they
        # # manage as well.)
        # sizer = wx.BoxSizer(wx.HORIZONTAL)
        # sizer.Add(box1, 0, wx.ALL, 10)
        # sizer.Add(box2, 0, wx.ALL, 10)
        # sizer.Add(box3, 0, wx.ALL, 10)
        #
        # box = wx.StaticBox(self.panel, -1, boxlabel)
        # sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        # bw = BlockWindow(self.panel, label=label)

        # sizer.Add(bw, 0, wx.ALL, 2)
        # self._btn1 = wx.Button(self.panel, wx.ID_ANY, "Click me")
        # self._btn2 = wx.Button(self.panel, wx.ID_ANY, "Click you")

        box1 = wx.StaticBox(self.panel, -1, "Box 1",  size=(300,200))
        # box1_sizer = wx.StaticBoxSizer(box1, wx.HORIZONTAL)
        box1_sizer = wx.GridSizer(box1, wx.HORIZONTAL)

        # Add(self, item, int proportion=0, int flag=0, int border=0,
        #     PyObject userData=None)
        bw1 = BlockWindow(self.panel, label="Block Window 1")
        box1_sizer.Add(bw1, 0, wx.ALL, border=2, pos=(0,0))

        # Add(self, item, int proportion=0, int flag=0, int border=0,
        #     PyObject userData=None
        rtb = wx.ToggleButton(self.panel, label='red')
        box1_sizer.Add(rtb, 0, wx.ALL, border=2, pos=(0,1))


        box2 = wx.StaticBox(self.panel, -1, "Box 2", size=(300,200))
        box2_sizer = wx.StaticBoxSizer(box2, wx.HORIZONTAL)

        bw2 = BlockWindow(self.panel, label="Block Window 2")
        box2_sizer.Add(bw2, 0, wx.ALL, 2)

        # gb_sizer = wx.GridBagSizer(hgap=5, vgap=5)
        #
        # _btn1 = wx.Button(self, wx.ID_ANY, "Click me")
        # # self._btn2 = wx.Button(self, wx.ID_ANY, "Click you")
        # #
        # gb_sizer.Add(_btn1, pos=(0, 4))

        # bw1 = BlockWindow(self, label="span 3 rows")
        # gb_sizer.Add(bw1, pos=(0, 3), span=(3, 1), flag=wx.EXPAND)
        #
        # self._btn1 = wx.Button(self, wx.ID_ANY, "Click me")
        # self._btn2 = wx.Button(self, wx.ID_ANY, "Click you")
        #
        # gb_sizer.Add(self._btn1, pos=(0, 4))
        # gb_sizer.Add(self._btn2, pos=(1, 4))
        # self.self_test_txt = wx.StaticText(self, -1, "my Right Panel")
        # sizer.Add(self.self_test_txt, pos=(2, 4))


        gb_sizer = wx.GridBagSizer(hgap=5, vgap=5)
        gb_sizer.Add(box1_sizer, pos=(0, 1), span=(3, 1), flag=wx.EXPAND)
        gb_sizer.Add(box2_sizer, pos=(0, 2), span=(3, 1), flag=wx.EXPAND)
        # gb_sizer.Add(gb_sizer, pos=(0, 3), span=(3, 1), flag=wx.EXPAND)

        self.panel.SetSizer(gb_sizer)
        gb_sizer.Fit(self)
Exemplo n.º 10
0
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self,
                          id=wxID_DIRTABLEVIEWER,
                          name='dirtableviewer',
                          parent=prnt,
                          pos=wx.Point(451, 273),
                          size=wx.Size(497, 459),
                          style=wx.DEFAULT_FRAME_STYLE ^ wx.MAXIMIZE_BOX
                          ^ wx.RESIZE_BORDER,
                          title='Directory Table Viewer')

        self.Centre()

        self.SetClientSize(wx.Size(481, 423))

        self._exporttable_rva = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_EXPORTTABLE_RVA,
            name='_exporttable_rva',
            parent=self,
            pos=wx.Point(128, 64),
            size=wx.Size(88, 21),
            style=0,
            value='')

        self._importtable_rva = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_IMPORTTABLE_RVA,
            name='_importtable_rva',
            parent=self,
            pos=wx.Point(128, 88),
            size=wx.Size(88, 21),
            style=0,
            value='')

        self.aplychanges = wx.Button(id=wxID_DIRTABLEVIEWERAPLYCHANGES,
                                     label='Apply Changes',
                                     name='aplychanges',
                                     parent=self,
                                     pos=wx.Point(376, 32),
                                     size=wx.Size(83, 23),
                                     style=0)

        self.rva_and_size = wx.StaticBox(id=wxID_DIRTABLEVIEWERRVA_AND_SIZE,
                                         label='',
                                         name='rva_and_size',
                                         parent=self,
                                         pos=wx.Point(8, 8),
                                         size=wx.Size(344, 408),
                                         style=0)

        self.options = wx.StaticBox(id=wxID_DIRTABLEVIEWEROPTIONS,
                                    label='Options',
                                    name='options',
                                    parent=self,
                                    pos=wx.Point(360, 8),
                                    size=wx.Size(112, 88),
                                    style=0)

        self.view = wx.StaticBox(id=wxID_DIRTABLEVIEWERVIEW,
                                 label='View',
                                 name='view',
                                 parent=self,
                                 pos=wx.Point(360, 96),
                                 size=wx.Size(112, 320),
                                 style=0)

        self.exit = wx.Button(id=wxID_DIRTABLEVIEWEREXIT,
                              label='Exit',
                              name='exit',
                              parent=self,
                              pos=wx.Point(376, 64),
                              size=wx.Size(83, 23),
                              style=0)

        self._resource_rva = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_RESOURCE_RVA,
                                         name='_resource_rva',
                                         parent=self,
                                         pos=wx.Point(128, 112),
                                         size=wx.Size(88, 21),
                                         style=0,
                                         value='')

        self._exception_rva = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_EXCEPTION_RVA,
                                          name='_exception_rva',
                                          parent=self,
                                          pos=wx.Point(128, 136),
                                          size=wx.Size(88, 21),
                                          style=0,
                                          value='')

        self._security_rva = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_SECURITY_RVA,
                                         name='_security_rva',
                                         parent=self,
                                         pos=wx.Point(128, 160),
                                         size=wx.Size(88, 21),
                                         style=0,
                                         value='')

        self._basereloc_rva = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_BASERELOC_RVA,
                                          name='_basereloc_rva',
                                          parent=self,
                                          pos=wx.Point(128, 184),
                                          size=wx.Size(88, 21),
                                          style=0,
                                          value='')

        self._debug_rva = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_DEBUG_RVA,
                                      name='_debug_rva',
                                      parent=self,
                                      pos=wx.Point(128, 208),
                                      size=wx.Size(88, 21),
                                      style=0,
                                      value='')

        self._copyright_rva = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_COPYRIGHT_RVA,
                                          name='_copyright_rva',
                                          parent=self,
                                          pos=wx.Point(128, 232),
                                          size=wx.Size(88, 21),
                                          style=0,
                                          value='')

        self._globalptr_rva = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_GLOBALPTR_RVA,
                                          name='_globalptr_rva',
                                          parent=self,
                                          pos=wx.Point(128, 256),
                                          size=wx.Size(88, 21),
                                          style=0,
                                          value='')

        self._tlstable_rva = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_TLSTABLE_RVA,
                                         name='_tlstable_rva',
                                         parent=self,
                                         pos=wx.Point(128, 280),
                                         size=wx.Size(88, 21),
                                         style=0,
                                         value='')

        self._loadconfig_rva = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_LOADCONFIG_RVA,
            name='_loadconfig_rva',
            parent=self,
            pos=wx.Point(128, 304),
            size=wx.Size(88, 21),
            style=0,
            value='')

        self._boundimport_rva = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_BOUNDIMPORT_RVA,
            name='_boundimport_rva',
            parent=self,
            pos=wx.Point(128, 328),
            size=wx.Size(88, 21),
            style=0,
            value='')

        self._iat_rva = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_IAT_RVA,
                                    name='_iat_rva',
                                    parent=self,
                                    pos=wx.Point(128, 352),
                                    size=wx.Size(88, 21),
                                    style=0,
                                    value='')

        self.exports = wx.Button(id=wxID_DIRTABLEVIEWEREXPORTS,
                                 label='Exports',
                                 name='exports',
                                 parent=self,
                                 pos=wx.Point(376, 120),
                                 size=wx.Size(83, 23),
                                 style=0)

        self.imports = wx.Button(id=wxID_DIRTABLEVIEWERIMPORTS,
                                 label='Imports',
                                 name='imports',
                                 parent=self,
                                 pos=wx.Point(376, 152),
                                 size=wx.Size(83, 23),
                                 style=0)

        self.rsc = wx.Button(id=wxID_DIRTABLEVIEWERRSC,
                             label='Resource',
                             name='rsc',
                             parent=self,
                             pos=wx.Point(376, 184),
                             size=wx.Size(83, 23),
                             style=0)

        self.dbg = wx.Button(id=wxID_DIRTABLEVIEWERDBG,
                             label='Debug',
                             name='dbg',
                             parent=self,
                             pos=wx.Point(376, 216),
                             size=wx.Size(83, 23),
                             style=0)

        self.tls = wx.Button(id=wxID_DIRTABLEVIEWERTLS,
                             label='TLS',
                             name='tls',
                             parent=self,
                             pos=wx.Point(376, 248),
                             size=wx.Size(83, 23),
                             style=0)

        self.exporttable = wx.StaticText(id=wxID_DIRTABLEVIEWEREXPORTTABLE,
                                         label='Export Table',
                                         name='exporttable',
                                         parent=self,
                                         pos=wx.Point(16, 64),
                                         size=wx.Size(62, 13),
                                         style=0)

        self.importtable = wx.StaticText(id=wxID_DIRTABLEVIEWERIMPORTTABLE,
                                         label='Import Table',
                                         name='importtable',
                                         parent=self,
                                         pos=wx.Point(16, 88),
                                         size=wx.Size(62, 13),
                                         style=0)

        self.resource = wx.StaticText(id=wxID_DIRTABLEVIEWERRESOURCE,
                                      label='Resource',
                                      name='resource',
                                      parent=self,
                                      pos=wx.Point(16, 112),
                                      size=wx.Size(46, 13),
                                      style=0)

        self.exception = wx.StaticText(id=wxID_DIRTABLEVIEWEREXCEPTION,
                                       label='Exception',
                                       name='exception',
                                       parent=self,
                                       pos=wx.Point(16, 136),
                                       size=wx.Size(48, 13),
                                       style=0)

        self.security = wx.StaticText(id=wxID_DIRTABLEVIEWERSECURITY,
                                      label='Security',
                                      name='security',
                                      parent=self,
                                      pos=wx.Point(16, 160),
                                      size=wx.Size(40, 13),
                                      style=0)

        self.basereloc = wx.StaticText(id=wxID_DIRTABLEVIEWERBASERELOC,
                                       label='Base Reloc',
                                       name='basereloc',
                                       parent=self,
                                       pos=wx.Point(16, 184),
                                       size=wx.Size(53, 13),
                                       style=0)

        self.debug = wx.StaticText(id=wxID_DIRTABLEVIEWERDEBUG,
                                   label='Debug',
                                   name='debug',
                                   parent=self,
                                   pos=wx.Point(16, 208),
                                   size=wx.Size(32, 13),
                                   style=0)

        self.copyright = wx.StaticText(id=wxID_DIRTABLEVIEWERCOPYRIGHT,
                                       label='Copyright',
                                       name='copyright',
                                       parent=self,
                                       pos=wx.Point(16, 232),
                                       size=wx.Size(48, 13),
                                       style=0)

        self.globalptr = wx.StaticText(id=wxID_DIRTABLEVIEWERGLOBALPTR,
                                       label='Globalptr',
                                       name='globalptr',
                                       parent=self,
                                       pos=wx.Point(16, 256),
                                       size=wx.Size(44, 13),
                                       style=0)

        self.tlstable = wx.StaticText(id=wxID_DIRTABLEVIEWERTLSTABLE,
                                      label='TlsTable',
                                      name='tlstable',
                                      parent=self,
                                      pos=wx.Point(16, 280),
                                      size=wx.Size(40, 13),
                                      style=0)

        self.loadconfig = wx.StaticText(id=wxID_DIRTABLEVIEWERLOADCONFIG,
                                        label='Load Config',
                                        name='loadconfig',
                                        parent=self,
                                        pos=wx.Point(16, 304),
                                        size=wx.Size(58, 13),
                                        style=0)

        self.boundimport = wx.StaticText(id=wxID_DIRTABLEVIEWERBOUNDIMPORT,
                                         label='Bound Import',
                                         name='boundimport',
                                         parent=self,
                                         pos=wx.Point(16, 328),
                                         size=wx.Size(66, 13),
                                         style=0)

        self.importaddresstable = wx.StaticText(
            id=wxID_DIRTABLEVIEWERIMPORTADDRESSTABLE,
            label='Import Address Table',
            name='importaddresstable',
            parent=self,
            pos=wx.Point(16, 352),
            size=wx.Size(104, 13),
            style=0)

        self.rva = wx.StaticText(id=wxID_DIRTABLEVIEWERRVA,
                                 label='RVA',
                                 name='rva',
                                 parent=self,
                                 pos=wx.Point(160, 40),
                                 size=wx.Size(21, 13),
                                 style=0)

        self.size = wx.StaticText(id=wxID_DIRTABLEVIEWERSIZE,
                                  label='Size',
                                  name='size',
                                  parent=self,
                                  pos=wx.Point(272, 40),
                                  size=wx.Size(20, 13),
                                  style=0)

        self._exporttable_size = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_EXPORTTABLE_SIZE,
            name='_exporttable_size',
            parent=self,
            pos=wx.Point(232, 64),
            size=wx.Size(100, 21),
            style=0,
            value='')

        self._importtable_size = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_IMPORTTABLE_SIZE,
            name='_importtable_size',
            parent=self,
            pos=wx.Point(232, 88),
            size=wx.Size(100, 21),
            style=0,
            value='')

        self._resource_size = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_RESOURCE_SIZE,
                                          name='_resource_size',
                                          parent=self,
                                          pos=wx.Point(232, 112),
                                          size=wx.Size(100, 21),
                                          style=0,
                                          value='')

        self._exception_size = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_EXCEPTION_SIZE,
            name='_exception_size',
            parent=self,
            pos=wx.Point(232, 136),
            size=wx.Size(100, 21),
            style=0,
            value='')

        self._security_size = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_SECURITY_SIZE,
                                          name='_security_size',
                                          parent=self,
                                          pos=wx.Point(232, 160),
                                          size=wx.Size(100, 21),
                                          style=0,
                                          value='')

        self._basereloc_size = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_BASERELOC_SIZE,
            name='_basereloc_size',
            parent=self,
            pos=wx.Point(232, 184),
            size=wx.Size(100, 21),
            style=0,
            value='')

        self._debug_size = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_DEBUG_SIZE,
                                       name='_debug_size',
                                       parent=self,
                                       pos=wx.Point(232, 208),
                                       size=wx.Size(100, 21),
                                       style=0,
                                       value='')

        self._copyright_size = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_COPYRIGHT_SIZE,
            name='_copyright_size',
            parent=self,
            pos=wx.Point(232, 232),
            size=wx.Size(100, 21),
            style=0,
            value='')

        self._globalptr_size = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_GLOBALPTR_SIZE,
            name='_globalptr_size',
            parent=self,
            pos=wx.Point(232, 256),
            size=wx.Size(100, 21),
            style=0,
            value='')

        self._tlstable_size = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_TLSTABLE_SIZE,
                                          name='_tlstable_size',
                                          parent=self,
                                          pos=wx.Point(232, 280),
                                          size=wx.Size(100, 21),
                                          style=0,
                                          value='')

        self._loadconfig_size = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_LOADCONFIG_SIZE,
            name='_loadconfig_size',
            parent=self,
            pos=wx.Point(232, 304),
            size=wx.Size(100, 21),
            style=0,
            value='')

        self._boundimport_size = wx.TextCtrl(
            id=wxID_DIRTABLEVIEWER_BOUNDIMPORT_SIZE,
            name='_boundimport_size',
            parent=self,
            pos=wx.Point(232, 328),
            size=wx.Size(100, 21),
            style=0,
            value='')

        self._iat_size = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_IAT_SIZE,
                                     name='_iat_size',
                                     parent=self,
                                     pos=wx.Point(232, 352),
                                     size=wx.Size(100, 21),
                                     style=0,
                                     value='')

        self._bound_imports = wx.Button(id=wxID_DIRTABLEVIEWER_BOUND_IMPORTS,
                                        label='Bound Imports',
                                        name='_bound_imports',
                                        parent=self,
                                        pos=wx.Point(376, 280),
                                        size=wx.Size(83, 23),
                                        style=0)

        self._relocs = wx.Button(id=wxID_DIRTABLEVIEWER_RELOCS,
                                 label='Relocations',
                                 name='_relocs',
                                 parent=self,
                                 pos=wx.Point(376, 312),
                                 size=wx.Size(83, 23),
                                 style=0)

        self._copyright = wx.Button(id=wxID_DIRTABLEVIEWER_COPYRIGHT,
                                    label='Copyright',
                                    name='_copyright',
                                    parent=self,
                                    pos=wx.Point(376, 344),
                                    size=wx.Size(83, 23),
                                    style=0)

        self._com = wx.Button(id=wxID_DIRTABLEVIEWER_COM,
                              label='COM',
                              name='_com',
                              parent=self,
                              pos=wx.Point(376, 376),
                              size=wx.Size(83, 23),
                              style=0)

        self.com = wx.StaticText(id=wxID_DIRTABLEVIEWERCOM,
                                 label='COM',
                                 name='com',
                                 parent=self,
                                 pos=wx.Point(16, 376),
                                 size=wx.Size(24, 13),
                                 style=0)

        self._com_rva = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_COM_RVA,
                                    name='_com_rva',
                                    parent=self,
                                    pos=wx.Point(128, 376),
                                    size=wx.Size(88, 21),
                                    style=0,
                                    value='')

        self._com_size = wx.TextCtrl(id=wxID_DIRTABLEVIEWER_COM_SIZE,
                                     name='_com_size',
                                     parent=self,
                                     pos=wx.Point(232, 376),
                                     size=wx.Size(100, 21),
                                     style=0,
                                     value='')

        self.Bind(wx.EVT_BUTTON,
                  self.OnRelocsButton,
                  id=wxID_DIRTABLEVIEWER_RELOCS)
        self.Bind(wx.EVT_BUTTON, self.OnComButton, id=wxID_DIRTABLEVIEWER_COM)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_BUTTON, self.OnDebugButton, id=wxID_DIRTABLEVIEWERDBG)
        self.Bind(wx.EVT_BUTTON,
                  self.OnBoundImportsButton,
                  id=wxID_DIRTABLEVIEWER_BOUND_IMPORTS)
        self.Bind(wx.EVT_BUTTON, self.OnTLSButton, id=wxID_DIRTABLEVIEWERTLS)

        self.imports.Bind(wx.EVT_BUTTON,
                          self.OnImportsButton,
                          id=wxID_DIRTABLEVIEWERIMPORTS)
        self.exit.Bind(wx.EVT_BUTTON,
                       self.OnExitButton,
                       id=wxID_DIRTABLEVIEWEREXIT)
        self.aplychanges.Bind(wx.EVT_BUTTON,
                              self.OnApplyChangesButton,
                              id=wxID_DIRTABLEVIEWERAPLYCHANGES)
        self.exports.Bind(wx.EVT_BUTTON,
                          self.OnExportsButton,
                          id=wxID_DIRTABLEVIEWEREXPORTS)
Exemplo n.º 11
0
    def __init__(self, parent, IDperiode=None, IDactivite=None):
        wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE)
        self.parent = parent
        self.IDperiode = IDperiode
        self.IDactivite = IDactivite

        # Bandeau
        if self.IDperiode == None:
            titre = _(u"Saisie d'une nouvelle période de réservations")
        else:
            titre = _(u"Modification d'une période de réservations")
        self.SetTitle(titre)
        intro = _(
            u"Définissez ici une période en renseignant le nom de la période, la période correspondante dans le calendrier des ouvertures et une éventuelle période daffichage sur le portail."
        )
        self.ctrl_bandeau = CTRL_Bandeau.Bandeau(
            self,
            titre=titre,
            texte=intro,
            hauteurHtml=30,
            nomImage="Images/32x32/Emails_exp.png")

        # Nom
        self.box_nom_staticbox = wx.StaticBox(self, -1,
                                              _(u"Nom de la période"))
        self.ctrl_nom = wx.TextCtrl(self, -1, "")

        # Introduction
        self.box_intro_staticbox = wx.StaticBox(self, -1,
                                                _(u"Texte d'introduction"))
        self.ctrl_intro = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
        self.ctrl_intro.SetMinSize((10, 50))

        # Période
        self.box_periode_staticbox = wx.StaticBox(
            self, -1, _(u"Période de réservations"))
        self.label_date_debut = wx.StaticText(self, -1, u"Du")
        self.ctrl_date_debut = CTRL_Saisie_date.Date2(self)
        self.label_date_fin = wx.StaticText(self, -1, _(u"au"))
        self.ctrl_date_fin = CTRL_Saisie_date.Date2(self)

        # Affichage
        self.box_affichage_staticbox = wx.StaticBox(
            self, -1, _(u"Affichage sur le portail"))
        self.radio_oui = wx.RadioButton(self,
                                        -1,
                                        _(u"Toujours afficher"),
                                        style=wx.RB_GROUP)
        self.radio_dates = wx.RadioButton(
            self, -1, _(u"Afficher uniquement sur la période suivante :"))
        self.label_affichage_date_debut = wx.StaticText(self, -1, _(u"Du"))
        self.ctrl_affichage_date_debut = CTRL_Saisie_date.Date2(self)
        self.ctrl_affichage_heure_debut = CTRL_Saisie_heure.Heure(self)
        self.label_affichage_date_fin = wx.StaticText(self, -1, _(u"au"))
        self.ctrl_affichage_date_fin = CTRL_Saisie_date.Date2(self)
        self.ctrl_affichage_heure_fin = CTRL_Saisie_heure.Heure(self)
        self.radio_non = wx.RadioButton(self, -1, _(u"Ne pas afficher"))

        # Modèle d'Email de réponse associé
        self.box_modele_staticbox = wx.StaticBox(
            self, -1, _(u"Modèle d'Email de réponse"))
        self.radio_modele_defaut = wx.RadioButton(
            self, -1, _(u"Utiliser le modèle par défaut"), style=wx.RB_GROUP)
        self.radio_modele_choix = wx.RadioButton(
            self, -1, _(u"Utiliser le modèle suivant :"))
        self.ctrl_modele_email = CTRL_Choix_modele(self)
        self.bouton_gestion_modeles = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Mecanisme.png"),
                      wx.BITMAP_TYPE_ANY))

        # Préfacturation
        self.box_prefacturation_staticbox = wx.StaticBox(
            self, -1, _(u"Préfacturation"))
        self.ctrl_prefacturation = wx.CheckBox(
            self, -1, _(u"Activer la préfacturation pour cette période"))

        # Boutons
        self.bouton_aide = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png")
        self.bouton_ok = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Ok"), cheminImage="Images/32x32/Valider.png")
        self.bouton_annuler = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png")

        self.__set_properties()
        self.__do_layout()

        # Binds
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioAffichage, self.radio_oui)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioAffichage, self.radio_dates)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioAffichage, self.radio_non)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioModele,
                  self.radio_modele_defaut)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioModele,
                  self.radio_modele_choix)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonModeles,
                  self.bouton_gestion_modeles)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler)

        # Init contrôles
        self.Importation()
        self.OnRadioAffichage(None)
        self.OnRadioModele(None)
Exemplo n.º 12
0
    def __init__(self, parent, id):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "Parameters",
                          style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        self.parent = parent

        self.qName1 = wx.StaticText(self, -1, "Type:")
        self.qName2 = wx.Choice(self, -1, choices=apod_list)
        self.Bind(wx.EVT_CHOICE, self.ApodChoose, self.qName2)

        self.q1_1 = wx.StaticText(self, -1, "q1:")
        self.q1_2 = wx.TextCtrl(self, -1, "0.0")

        self.q2_1 = wx.StaticText(self, -1, "q2:")
        self.q2_2 = wx.TextCtrl(self, -1, "1.0")

        self.q3_1 = wx.StaticText(self, -1, "q3:")
        self.q3_2 = wx.TextCtrl(self, -1, "1.0")

        self.c1 = wx.StaticText(self, -1, "c")
        self.c2 = wx.TextCtrl(self, -1, "1.0")

        self.start_1 = wx.StaticText(self, -1, "Start")
        self.start_2 = wx.TextCtrl(self, -1, "1.0")

        self.size_1 = wx.StaticText(self, -1, "Size")
        self.size_1.Enable(False)
        self.size_2 = wx.TextCtrl(self, -1, "1.0")
        self.size_2.Enable(False)

        self.inv = wx.CheckBox(self, -1, "Invert")

        self.use_size = wx.CheckBox(self, -1, "Custom Size")
        self.Bind(wx.EVT_CHECKBOX, self.OnLimitCheck, self.use_size)

        self.points_1 = wx.StaticText(self, -1, "Number of Points:")
        self.points_2 = wx.TextCtrl(self, -1, "1000")

        self.sw_1 = wx.StaticText(self, -1, "Spectral Width:")
        self.sw_2 = wx.TextCtrl(self, -1, "50000.")

        self.b1 = wx.Button(self, 10, "Draw")
        self.Bind(wx.EVT_BUTTON, self.OnDraw, self.b1)
        self.b1.SetDefault()

        self.b2 = wx.Button(self, 20, "Clear")
        self.Bind(wx.EVT_BUTTON, self.OnClear, self.b2)
        self.b2.SetDefault()

        self.InitApod("SP")

        # layout
        apod_grid = wx.GridSizer(8, 2)

        apod_grid.AddMany([
            self.qName1, self.qName2, self.q1_1, self.q1_2, self.q2_1,
            self.q2_2, self.q3_1, self.q3_2, self.c1, self.c2, self.start_1,
            self.start_2, self.size_1, self.size_2, self.inv, self.use_size
        ])

        data_grid = wx.GridSizer(2, 2)
        data_grid.AddMany([self.points_1, self.points_2, self.sw_1, self.sw_2])

        apod_box = wx.StaticBoxSizer(
            wx.StaticBox(self, -1, "Apodization Parameters"))
        apod_box.Add(apod_grid)

        data_box = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Data Parameters"))
        data_box.Add(data_grid)

        button_box = wx.GridSizer(1, 2)
        button_box.AddMany([self.b1, self.b2])

        mainbox = wx.BoxSizer(wx.VERTICAL)
        mainbox.Add(apod_box)
        mainbox.Add(data_box)
        mainbox.Add(button_box)
        self.SetSizer(mainbox)

        self.Fit()
        self.SetMinSize(self.GetSize())
Exemplo n.º 13
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=u"多功能主机扫描和服务发现0.0",
                          pos=wx.DefaultPosition,
                          size=wx.Size(742, 646),
                          style=wx.DEFAULT_FRAME_STYLE | wx.DOUBLE_BORDER
                          | wx.FULL_REPAINT_ON_RESIZE | wx.TAB_TRAVERSAL)

        self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)
        self.SetForegroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNTEXT))
        self.SetBackgroundColour(wx.Colour(140, 208, 143))

        gSizer3 = wx.GridSizer(0, 2, 0, 0)

        bSizer14 = wx.BoxSizer(wx.VERTICAL)

        sbSizer7 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"扫描模式"),
                                     wx.VERTICAL)

        self.m_staticText38 = wx.StaticText(sbSizer7.GetStaticBox(), wx.ID_ANY,
                                            u"TCP主机识别", wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.m_staticText38.Wrap(-1)
        sbSizer7.Add(self.m_staticText38, 0, wx.ALL | wx.EXPAND, 5)

        self.m_staticText39 = wx.StaticText(sbSizer7.GetStaticBox(), wx.ID_ANY,
                                            u"服务扫描", wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.m_staticText39.Wrap(-1)
        sbSizer7.Add(self.m_staticText39, 0, wx.ALL, 5)

        self.m_staticText40 = wx.StaticText(sbSizer7.GetStaticBox(), wx.ID_ANY,
                                            u"操作系统扫描", wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.m_staticText40.Wrap(-1)
        sbSizer7.Add(self.m_staticText40, 0, wx.ALL, 5)

        self.m_staticText41 = wx.StaticText(sbSizer7.GetStaticBox(), wx.ID_ANY,
                                            u"综合扫描", wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.m_staticText41.Wrap(-1)
        sbSizer7.Add(self.m_staticText41, 0, wx.ALL, 5)

        bSizer14.Add(sbSizer7, 1, wx.EXPAND, 5)

        gSizer3.Add(bSizer14, 1, wx.EXPAND, 5)

        sbSizer8 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"参数设置"),
                                     wx.VERTICAL)

        bSizer16 = wx.BoxSizer(wx.VERTICAL)

        gSizer7 = wx.GridSizer(0, 2, 0, 0)

        bSizer30 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText54 = wx.StaticText(sbSizer8.GetStaticBox(), wx.ID_ANY,
                                            u"键入参数ip", wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.m_staticText54.Wrap(-1)
        bSizer30.Add(self.m_staticText54, 0, wx.ALL | wx.EXPAND, 5)

        gSizer7.Add(bSizer30, 1, wx.EXPAND, 5)

        bSizer29 = wx.BoxSizer(wx.VERTICAL)

        self.m_textCtrl26 = wx.TextCtrl(sbSizer8.GetStaticBox(), wx.ID_ANY,
                                        wx.EmptyString, wx.DefaultPosition,
                                        wx.DefaultSize, wx.TE_AUTO_URL)
        bSizer29.Add(self.m_textCtrl26, 0, wx.ALL, 5)

        self.m_textCtrl27 = wx.TextCtrl(sbSizer8.GetStaticBox(), wx.ID_ANY,
                                        wx.EmptyString, wx.DefaultPosition,
                                        wx.DefaultSize, 0)
        bSizer29.Add(self.m_textCtrl27, 0, wx.ALL, 5)

        self.m_textCtrl28 = wx.TextCtrl(sbSizer8.GetStaticBox(), wx.ID_ANY,
                                        wx.EmptyString, wx.DefaultPosition,
                                        wx.DefaultSize, 0)
        bSizer29.Add(self.m_textCtrl28, 0, wx.ALL, 5)

        self.m_textCtrl29 = wx.TextCtrl(sbSizer8.GetStaticBox(), wx.ID_ANY,
                                        wx.EmptyString, wx.DefaultPosition,
                                        wx.DefaultSize, 0)
        bSizer29.Add(self.m_textCtrl29, 0, wx.ALL, 5)

        gSizer7.Add(bSizer29, 1, wx.EXPAND, 5)

        bSizer16.Add(gSizer7, 1, wx.EXPAND, 5)

        sbSizer8.Add(bSizer16, 1, wx.EXPAND, 5)

        gSizer3.Add(sbSizer8, 1, wx.EXPAND, 5)

        bSizer28 = wx.BoxSizer(wx.VERTICAL)

        sbSizer6 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"结果"),
                                     wx.VERTICAL)

        self.m_richText1 = wx.richtext.RichTextCtrl(
            sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString,
            wx.DefaultPosition, wx.DefaultSize,
            0 | wx.VSCROLL | wx.HSCROLL | wx.NO_BORDER | wx.WANTS_CHARS)
        sbSizer6.Add(self.m_richText1, 1, wx.EXPAND | wx.ALL, 5)

        bSizer28.Add(sbSizer6, 1, wx.EXPAND, 5)

        gSizer3.Add(bSizer28, 1, wx.EXPAND, 5)

        bSizer26 = wx.BoxSizer(wx.VERTICAL)

        sbSizer5 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"执行"),
                                     wx.VERTICAL)

        self.m_staticText48 = wx.StaticText(sbSizer5.GetStaticBox(), wx.ID_ANY,
                                            u"点击按钮开始扫描", wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.m_staticText48.Wrap(-1)
        sbSizer5.Add(self.m_staticText48, 0, wx.ALL, 5)

        self.m_button18 = wx.Button(sbSizer5.GetStaticBox(), wx.ID_ANY,
                                    u"SCAN", wx.DefaultPosition,
                                    wx.DefaultSize, 0)
        sbSizer5.Add(self.m_button18, 0, wx.ALL, 5)

        self.m_gauge2 = wx.Gauge(sbSizer5.GetStaticBox(), wx.ID_ANY, 100,
                                 wx.DefaultPosition, wx.DefaultSize,
                                 wx.GA_HORIZONTAL)
        self.m_gauge2.SetValue(0)
        sbSizer5.Add(self.m_gauge2, 0, wx.ALL, 5)

        bSizer26.Add(sbSizer5, 1, wx.EXPAND, 5)

        gSizer3.Add(bSizer26, 1, wx.EXPAND, 5)

        self.SetSizer(gSizer3)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.m_textCtrl26.Bind(wx.EVT_TEXT, self.pram)
        self.m_button18.Bind(wx.EVT_BUTTON, self.onclick)
Exemplo n.º 14
0
 def __do_layout(self):
     # begin wxGlade: wxgReviewDocPartDlg.__do_layout
     __szr_main = wx.BoxSizer(wx.VERTICAL)
     __szr_bottom = wx.BoxSizer(wx.HORIZONTAL)
     __szr_box_review = wx.StaticBoxSizer(
         wx.StaticBox(self, wx.ID_ANY, _("Your review")), wx.VERTICAL)
     __szr_grid_review = wx.FlexGridSizer(4, 2, 0, 0)
     __szr_reviews = wx.StaticBoxSizer(
         wx.StaticBox(self, wx.ID_ANY, _("Reviews by others")),
         wx.HORIZONTAL)
     __szr_grid_properties = wx.FlexGridSizer(8, 2, 2, 3)
     __szr_org_details = wx.BoxSizer(wx.HORIZONTAL)
     __lbl_episode_picker = wx.StaticText(self, wx.ID_ANY, _("Episode"))
     __lbl_episode_picker.SetForegroundColour(wx.Colour(255, 0, 0))
     __szr_grid_properties.Add(__lbl_episode_picker, 0,
                               wx.ALIGN_CENTER_VERTICAL, 0)
     __szr_grid_properties.Add(self._PhWheel_episode, 1,
                               wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     __lbl_type = wx.StaticText(self, wx.ID_ANY, _("Type"))
     __lbl_type.SetForegroundColour(wx.Colour(255, 0, 0))
     __szr_grid_properties.Add(__lbl_type, 0, wx.ALIGN_CENTER_VERTICAL, 0)
     __szr_grid_properties.Add(self._PhWheel_doc_type, 1,
                               wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     __lbl_org = wx.StaticText(self, wx.ID_ANY, _("Source"))
     __szr_grid_properties.Add(__lbl_org, 0, wx.ALIGN_CENTER_VERTICAL, 0)
     __szr_org_details.Add(self._PRW_org, 1,
                           wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     __lbl_org_arrow = wx.StaticText(self, wx.ID_ANY, _(u"\u2794"))
     __szr_org_details.Add(__lbl_org_arrow, 0,
                           wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 5)
     __szr_org_details.Add(self._RBTN_org_is_source, 0,
                           wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT,
                           3)
     __szr_org_details.Add(self._RBTN_org_is_receiver, 0,
                           wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 3)
     __szr_grid_properties.Add(__szr_org_details, 1, wx.EXPAND, 0)
     __lbl_comment = wx.StaticText(self, wx.ID_ANY, _("Comment"))
     __szr_grid_properties.Add(__lbl_comment, 0, wx.ALIGN_CENTER_VERTICAL,
                               0)
     __szr_grid_properties.Add(self._PRW_doc_comment, 1,
                               wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     __lbl_doc_date = wx.StaticText(self, wx.ID_ANY, _("Date"))
     __lbl_doc_date.SetForegroundColour(wx.Colour(255, 0, 0))
     __szr_grid_properties.Add(__lbl_doc_date, 0, wx.ALIGN_CENTER_VERTICAL,
                               0)
     __szr_grid_properties.Add(self._PhWheel_doc_date, 1,
                               wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     __lbl_reference = wx.StaticText(self, wx.ID_ANY, _("Reference"))
     __szr_grid_properties.Add(__lbl_reference, 0, wx.ALIGN_CENTER_VERTICAL,
                               0)
     __szr_grid_properties.Add(self._TCTRL_reference, 1, wx.EXPAND, 0)
     __lbl_filename = wx.StaticText(self, wx.ID_ANY, _("Filename"))
     __lbl_filename.SetToolTipString(
         _("The original filename (if any). Only editable if invoked from a single part of the document."
           ))
     __szr_grid_properties.Add(__lbl_filename, 0, wx.ALIGN_CENTER_VERTICAL,
                               0)
     __szr_grid_properties.Add(self._TCTRL_filename, 1,
                               wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     __lbl_seq_idx = wx.StaticText(self, wx.ID_ANY, _("Seq #"))
     __lbl_seq_idx.SetToolTipString(
         _("The sequence index or page number. If invoked from a document instead of a page always applies to the first page."
           ))
     __szr_grid_properties.Add(__lbl_seq_idx, 0, wx.ALIGN_CENTER_VERTICAL,
                               0)
     __szr_grid_properties.Add(self._SPINCTRL_seq_idx, 0,
                               wx.ALIGN_CENTER_VERTICAL, 0)
     __szr_grid_properties.AddGrowableCol(1)
     __szr_main.Add(__szr_grid_properties, 1, wx.BOTTOM | wx.EXPAND, 5)
     __szr_reviews.Add(self._LCTRL_existing_reviews, 1, wx.EXPAND, 0)
     __szr_main.Add(__szr_reviews, 1, wx.EXPAND, 0)
     __szr_box_review.Add(self._TCTRL_responsible, 0,
                          wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 0)
     __szr_grid_review.Add(self._ChBOX_review, 0, 0, 0)
     __szr_grid_review.Add((5, 5), 1, wx.EXPAND, 0)
     __szr_grid_review.Add(self._ChBOX_abnormal, 0, wx.LEFT, 10)
     __szr_grid_review.Add(self._ChBOX_responsible, 0, wx.LEFT, 10)
     __szr_grid_review.Add(self._ChBOX_relevant, 0, wx.LEFT, 10)
     __szr_grid_review.Add(self._ChBOX_sign_all_pages, 0, wx.LEFT, 10)
     __szr_box_review.Add(__szr_grid_review, 1, wx.EXPAND, 0)
     __szr_main.Add(__szr_box_review, 1, wx.EXPAND, 0)
     __szr_bottom.Add(self._BTN_save, 0, 0, 0)
     __szr_bottom.Add(self._BTN_cancel, 0, 0, 0)
     __szr_main.Add(__szr_bottom, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
     self.SetSizer(__szr_main)
     __szr_main.Fit(self)
     self.Layout()
     self.Centre()
    def __init__(self,
                 parent,
                 dictDonnees={},
                 afficheLargeurColonneUnite=True,
                 afficheAbregeGroupes=True,
                 abregeGroupes=False,
                 affichePresents=1):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           name="parametres_remplissage",
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                           | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX)
        self.parent = parent
        self.afficheLargeurColonneUnite = afficheLargeurColonneUnite

        # Périodes
        self.staticbox_periodes_staticbox = wx.StaticBox(
            self, -1, _(u"Période"))
        self.ctrl_periodes = CTRL_Grille_periode.CTRL(self)
        self.ctrl_periodes.SetMinSize((220, 230))

        # Activités
        self.staticbox_activites_staticbox = wx.StaticBox(
            self, -1, _(u"Activités"))
        self.ctrl_activites = CTRL_activites(self)
        self.ctrl_activites.SetMinSize((300, 150))

        self.ctrl_masquer_activites = wx.CheckBox(
            self, -1, _(u"Masquer les anciennes activités"))
        self.ctrl_masquer_activites.SetValue(
            UTILS_Parametres.Parametres(mode="get",
                                        categorie="parametres_remplissage",
                                        nom="masquer_anciennes_activites",
                                        valeur=0))
        self.ctrl_masquer_activites.SetFont(
            wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))

        # Options d'affichage
        self.staticbox_options_staticbox = wx.StaticBox(
            self, -1, _(u"Options"))

        self.label_abregeGroupes = wx.StaticText(
            self, -1, _(u"Utiliser le nom abrégé des groupes :"))
        self.ctrl_abregeGroupes_oui = wx.RadioButton(self,
                                                     -1,
                                                     _(u"Oui"),
                                                     style=wx.RB_GROUP)
        self.ctrl_abregeGroupes_non = wx.RadioButton(self, -1, _(u"Non"))
        if abregeGroupes == True:
            self.ctrl_abregeGroupes_oui.SetValue(True)
        else:
            self.ctrl_abregeGroupes_non.SetValue(True)

        self.label_affichePresents = wx.StaticText(
            self, -1, _(u"Afficher les présents en temps réel :"))
        self.ctrl_affichePresents_oui = wx.RadioButton(self,
                                                       -1,
                                                       _(u"Oui"),
                                                       style=wx.RB_GROUP)
        self.ctrl_affichePresents_non = wx.RadioButton(self, -1, _(u"Non"))
        if affichePresents == True:
            self.ctrl_affichePresents_oui.SetValue(True)
        else:
            self.ctrl_affichePresents_non.SetValue(True)

        if afficheAbregeGroupes == False:
            self.label_abregeGroupes.Show(False)
            self.ctrl_abregeGroupes_oui.Show(False)
            self.ctrl_abregeGroupes_non.Show(False)

        if self.afficheLargeurColonneUnite == False and afficheAbregeGroupes == False:
            self.label_affichePresents.Show(False)
            self.ctrl_affichePresents_oui.Show(False)
            self.ctrl_affichePresents_non.Show(False)
            self.staticbox_options_staticbox.Show(False)

        # Boutons de commandes
        self.bouton_ok = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Ok"), cheminImage="Images/32x32/Valider.png")
        self.bouton_annuler = CTRL_Bouton_image.CTRL(
            self,
            id=wx.ID_CANCEL,
            texte=_(u"Annuler"),
            cheminImage="Images/32x32/Annuler.png")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok)
        self.Bind(wx.EVT_CHECKBOX, self.OnCheckMasquerActivites,
                  self.ctrl_masquer_activites)

        # Init contrôles
        self.ctrl_activites.MAJ()

        # Applique les valeurs par défaut
        self.ctrl_periodes.SetDictDonnees(dictDonnees)
        self.ctrl_activites.SetDictDonnees(dictDonnees)
Exemplo n.º 16
0
    def __init__(self, parent, pipeline, visFrame, id=-1):
        wx.Panel.__init__(self, parent, id)
        bsizer = wx.BoxSizer(wx.VERTICAL)

        self.visFr = visFrame
        self.pipeline = pipeline

        self.colPlotPan = colourPlotPanel(self, pipeline, visFrame)
        bsizer.Add(self.colPlotPan, 4,
                   wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)

        #        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        #        hsizer.Add(wx.StaticText(self, -1, "x' = "), 0,wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
        #
        #        self.tXExpr = wx.TextCtrl(self, -1, self.driftExprX, size=(130, -1))
        #        hsizer.Add(self.tXExpr, 2,wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
        #
        #        bsizer.Add(hsizer, 0, wx.ALL, 0)
        #
        #        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        #        hsizer.Add(wx.StaticText(self, -1, "y' = "), 0,wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
        #
        #        self.tYExpr = wx.TextCtrl(self, -1, self.driftExprY, size=(130,-1))
        #        hsizer.Add(self.tYExpr, 2,wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5)
        #
        #        bsizer.Add(hsizer, 0, wx.ALL, 0)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        vsizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, 'Fluorophores'),
                                   wx.VERTICAL)

        self.lFluorSpecies = editList.EditListCtrl(
            self,
            -1,
            style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.SUNKEN_BORDER,
            size=(450, 100))
        vsizer.Add(self.lFluorSpecies, 0, wx.ALL, 5)

        self.lFluorSpecies.InsertColumn(0, 'Name')
        self.lFluorSpecies.InsertColumn(1, 'Ag/(Ag + Ar)')
        self.lFluorSpecies.InsertColumn(2, '# Events')
        self.lFluorSpecies.InsertColumn(3, 'dx')
        self.lFluorSpecies.InsertColumn(4, 'dy')
        self.lFluorSpecies.InsertColumn(5, 'dz')
        self.lFluorSpecies.makeColumnEditable(1)
        self.lFluorSpecies.makeColumnEditable(3)
        self.lFluorSpecies.makeColumnEditable(4)
        self.lFluorSpecies.makeColumnEditable(5)

        for key, value in self.pipeline.fluorSpecies.items():
            ind = self.lFluorSpecies.InsertStringItem(UI_MAXSIZE, key)
            self.lFluorSpecies.SetStringItem(ind, 1, '%3.2f' % value)
            self.lFluorSpecies.SetItemTextColour(
                ind, wx.Colour(*((128 * numpy.array(cm.jet_r(value)))[:3])))

        self.lFluorSpecies.SetColumnWidth(3, 60)
        self.lFluorSpecies.SetColumnWidth(4, 60)
        self.lFluorSpecies.SetColumnWidth(5, 60)

        ## only do this part the first time so the events are only bound once
        #if not hasattr(self, "ID_FILT_ADD"):
        self.ID_SPEC_ADD = wx.NewId()
        self.ID_SPEC_DELETE = wx.NewId()
        #self.ID_FILT_EDIT = wx.NewId()

        self.Bind(wx.EVT_MENU, self.OnSpecAdd, id=self.ID_SPEC_ADD)
        self.Bind(wx.EVT_MENU, self.OnSpecDelete, id=self.ID_SPEC_DELETE)
        #self.Bind(wx.EVT_MENU, self.OnFilterEdit, id=self.ID_FILT_EDIT)

        # for wxMSW
        self.lFluorSpecies.Bind(wx.EVT_COMMAND_RIGHT_CLICK,
                                self.OnSpecListRightClick)

        # for wxGTK
        self.lFluorSpecies.Bind(wx.EVT_RIGHT_UP, self.OnSpecListRightClick)

        #        self.lFluorSpecies.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSpecItemSelected)
        #        self.lFluorSpecies.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnSpecItemDeselected)
        #self.lFluorSpecies.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnFilterEdit)

        self.lFluorSpecies.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnSpecChange)

        self.bGuess = wx.Button(self, -1, 'Guess')
        self.bGuess.Bind(wx.EVT_BUTTON, self.OnSpecGuess)
        vsizer.Add(self.bGuess, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)

        hsizer.Add(vsizer, 0, wx.ALL, 5)

        vsizer = wx.StaticBoxSizer(
            wx.StaticBox(self, -1, 'Channel Assignment '), wx.VERTICAL)

        hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
        hsizer2.Add(wx.StaticText(self, -1, 'p_dye:   '), 0,
                    wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.tPBelong = wx.TextCtrl(
            self, -1, '%3.3f' % self.pipeline.colourFilter.t_p_dye)
        hsizer2.Add(self.tPBelong, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        self.tPBelong.Bind(wx.EVT_TEXT, self.OnChangePDye)

        vsizer.Add(hsizer2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 0)

        hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
        hsizer2.Add(wx.StaticText(self, -1, 'p_other:'), 0,
                    wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.tPOther = wx.TextCtrl(
            self, -1, '%3.3f' % self.pipeline.colourFilter.t_p_other)
        hsizer2.Add(self.tPOther, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        self.tPOther.Bind(wx.EVT_TEXT, self.OnChangePOther)

        vsizer.Add(hsizer2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 0)

        hsizer.Add(vsizer, 0, wx.ALL, 5)

        bsizer.Add(hsizer, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.SetSizer(bsizer)
        bsizer.Fit(self)

        self.Bind(wx.EVT_SHOW, self.OnShow)
Exemplo n.º 17
0
    def __init__(self, parent, splitter=None, size=(-1, -1)):
        wx.Panel.__init__(self, parent, -1, size=size)

        self.splitter = splitter

        vsizer = wx.BoxSizer(wx.VERTICAL)

        self.op = OptionsPanel(self, splitter.f.vp.do, horizOrientation=True)
        vsizer.Add(self.op, 0, wx.ALL, 0)

        psizer = wx.BoxSizer(wx.HORIZONTAL)

        bsizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, 'Mix Matrix'),
                                   wx.VERTICAL)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.tMM00 = wx.TextCtrl(self,
                                 -1,
                                 '%1.2f' % (self.splitter.mixMatrix[0, 0]),
                                 size=(40, -1))
        hsizer.Add(self.tMM00, 1, wx.ALL, 2)

        self.tMM01 = wx.TextCtrl(self,
                                 -1,
                                 '%1.2f' % (self.splitter.mixMatrix[0, 1]),
                                 size=(40, -1))
        hsizer.Add(self.tMM01, 1, wx.ALL, 2)

        bsizer.Add(hsizer, 0, wx.ALL, 0)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.tMM10 = wx.TextCtrl(self,
                                 -1,
                                 '%1.2f' % (self.splitter.mixMatrix[1, 0]),
                                 size=(40, -1))
        hsizer.Add(self.tMM10, 1, wx.ALL, 2)

        self.tMM11 = wx.TextCtrl(self,
                                 -1,
                                 '%1.2f' % (self.splitter.mixMatrix[1, 1]),
                                 size=(40, -1))
        hsizer.Add(self.tMM11, 1, wx.ALL, 2)

        bsizer.Add(hsizer, 0, wx.ALL, 0)

        psizer.Add(bsizer, 0, wx.ALL, 0)

        bsizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, 'Offset'),
                                   wx.HORIZONTAL)
        self.tOffset = wx.TextCtrl(self,
                                   -1,
                                   '%1.2f' % (self.splitter.offset),
                                   size=(40, -1))
        self.bGrabOffset = wx.Button(self, -1, 'C', style=wx.BU_EXACTFIT)

        bsizer.Add(self.tOffset, 1, wx.ALL, 0)
        bsizer.Add(self.bGrabOffset, 0, wx.LEFT, 5)
        psizer.Add(bsizer, 1, wx.LEFT | wx.RIGHT, 5)

        #        self.bUpdate = wx.Button(self, -1, 'Update')
        #        vsizer.Add(self.bUpdate, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5)
        #        self.bUpdate.Bind(wx.EVT_BUTTON, self.OnUpdateMix)

        vsizer.Add(psizer, 1, wx.ALL | wx.EXPAND, 0)
        self.SetSizerAndFit(vsizer)

        self.bGrabOffset.Bind(wx.EVT_BUTTON, self.OnGrabOffsetFromCamera)
        self.splitter.scope.pa.WantFrameGroupNotification.append(
            self.OnUpdateMix)
Exemplo n.º 18
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)

        #-------------------------------------------------------------------

        self.parent = parent

        #-------------------------------------------------------------------

        fontSize = self.GetFont().GetPointSize()

        # wx.Font(pointSize, family, style, weight, underline, faceName)
        if wx.Platform == "__WXMAC__":
            self.normalFont = wx.Font(fontSize - 4, wx.DEFAULT, wx.NORMAL,
                                      wx.NORMAL, False, "")

        elif wx.Platform == "__WXGTK__":
            self.normalFont = wx.Font(fontSize - 1, wx.DEFAULT, wx.NORMAL,
                                      wx.NORMAL, False, "")

        else:
            self.normalFont = wx.Font(fontSize + 0, wx.DEFAULT, wx.NORMAL,
                                      wx.NORMAL, False, "")

        self.SetFont(self.normalFont)

        #-------------------------------------------------------------------

        box = wx.StaticBox(self, -1, u"Argument n°2 :")
        box.SetForegroundColour("#0074ff")
        bsizer1 = wx.StaticBoxSizer(box, wx.VERTICAL)

        texte1 = wx.StaticText(self,
                               -1,
                               "Arg. Type = CONSTANT_TYPE + RELATIVE",
                               style=wx.ALIGN_LEFT)
        texte1.SetFont(self.normalFont)
        bsizer1.Add(texte1, 1, wx.ALL | wx.EXPAND, 0)

        texte1 = wx.StaticText(self,
                               -1,
                               "Access. Mode = READ",
                               style=wx.ALIGN_LEFT)
        texte1.SetFont(self.normalFont)
        bsizer1.Add(texte1, 1, wx.ALL | wx.EXPAND, 0)

        texte1 = wx.StaticText(self,
                               -1,
                               "Arg. Mnemonic = 40717Eh",
                               style=wx.ALIGN_LEFT)
        texte1.SetFont(self.normalFont)
        bsizer1.Add(texte1, 1, wx.ALL | wx.EXPAND, 0)

        texte1 = wx.StaticText(self,
                               -1,
                               "Arg. Size = 00000000",
                               style=wx.ALIGN_LEFT)
        texte1.SetFont(self.normalFont)
        bsizer1.Add(texte1, 1, wx.ALL | wx.EXPAND, 0)

        texte1 = wx.StaticText(self,
                               -1,
                               "Memory. Base Register = -",
                               style=wx.ALIGN_LEFT)
        texte1.SetFont(self.normalFont)
        bsizer1.Add(texte1, 1, wx.ALL | wx.EXPAND, 0)

        texte1 = wx.StaticText(self,
                               -1,
                               "Memory. Index Register = -",
                               style=wx.ALIGN_LEFT)
        texte1.SetFont(self.normalFont)
        bsizer1.Add(texte1, 1, wx.ALL | wx.EXPAND, 0)

        texte1 = wx.StaticText(self,
                               -1,
                               "Memory. Scale = 00000000",
                               style=wx.ALIGN_LEFT)
        texte1.SetFont(self.normalFont)
        bsizer1.Add(texte1, 1, wx.ALL | wx.EXPAND, 0)

        texte1 = wx.StaticText(self,
                               -1,
                               "Memory. Displacement = 00000000",
                               style=wx.ALIGN_LEFT)
        texte1.SetFont(self.normalFont)
        bsizer1.Add(texte1, 1, wx.ALL | wx.EXPAND, 0)

        #-------------------------------------------------------------------
        #-------------------------------------------------------------------

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(bsizer1, 1, wx.EXPAND | wx.TOP, 3)

        #----------

        topSizer = wx.BoxSizer(wx.VERTICAL)
        topSizer.Add(sizer, 1, wx.EXPAND | wx.TOP, 3)

        #----------

        self.SetSizer(topSizer)
        topSizer.Fit(self)
Exemplo n.º 19
0
 def __init__(self, parent):
     UI.Panel.__init__(self, parent)
     self.sizer = UI.BoxSizer(UI.VERTICAL)
     staticBoxDX = UI.StaticBox(self, label=u"单项")
     staticBoxSizerDX = UI.StaticBoxSizer(staticBoxDX, UI.VERTICAL)
     _dx = parent.database.Execute("SELECT * FROM DanXiang;")
     # sizerDX = UI.GridSizer(JieZhang.RowNumber, JieZhang.ColumnNumber) # FIXME: WX3.0 has a __init__(int, int) overload
     sizerDX = UI.GridSizer(JieZhang.ColumnNumber,
                            gap=(JieZhang.HorizontalGap,
                                 JieZhang.VerticalGap))
     self.checkbox = []
     for number, name, price in _dx:
         cb = UI.CheckBox(self, label=name)
         setattr(cb, "UserData", {
             "Number": number,
             "Name": name,
             "Price": price
         })
         self.checkbox.append(cb)
         sizerDX.Add(cb, proportion=FIXED, flag=UI.EXPAND | UI.ALL)
     staticBoxSizerDX.Add(sizerDX,
                          proportion=FIXED,
                          flag=UI.EXPAND | UI.ALL)
     _tc = parent.database.Execute("SELECT * FROM TaoCan;")
     item = []
     data = {}
     for combination, name, price in _tc:
         item.append(name)
         data[name] = {
             "Combination": combination,
             "Name": name,
             "Price": price
         }
     radioBoxTC = UI.RadioBox(self,
                              label=u"套餐",
                              choices=item,
                              majorDimension=JieZhang.MajorDimension)
     setattr(radioBoxTC, "UserData", data)
     self.sizer.Add(staticBoxSizerDX,
                    proportion=FIXED,
                    flag=UI.EXPAND | UI.ALL)
     self.sizer.Add(radioBoxTC,
                    proportion=FIXED,
                    flag=UI.EXPAND | UI.LEFT | UI.RIGHT)
     _yh = parent.database.Execute("SELECT * FROM YouHui;")
     item = []
     data = {}
     for number, activity, factor in _yh:
         item.append(activity)
         data[activity] = {
             "Number": number,
             "Activity": activity,
             "Factor": factor
         }
     radioBoxYH = UI.RadioBox(self,
                              label=u"优惠",
                              choices=item,
                              majorDimension=JieZhang.MajorDimension)
     setattr(radioBoxYH, "UserData", data)
     self.sizer.Add(radioBoxYH,
                    proportion=FIXED,
                    flag=UI.EXPAND | UI.LEFT | UI.RIGHT)
     sizerH = UI.BoxSizer(UI.HORIZONTAL)
     sizerV = UI.BoxSizer(UI.VERTICAL)
     self.due = UI.StaticText(self, id=JieZhang.IdDue, label=u"应付:0.00")
     self.search = UI.SearchCtrl(self,
                                 id=JieZhang.IdSearch,
                                 style=UI.TE_PROCESS_ENTER)
     self.balance = UI.StaticText(self,
                                  id=JieZhang.IdBalance,
                                  label=u"姓名:余额")
     self.pay = UI.Button(self, id=JieZhang.IdPay, label=u"支付")
     sizerV.Add(self.due,
                proportion=FIXED,
                flag=UI.EXPAND | UI.LEFT | UI.RIGHT)
     sizerV.Add(self.search,
                proportion=FIXED,
                flag=UI.EXPAND | UI.LEFT | UI.RIGHT)
     sizerV.Add(self.balance,
                proportion=FIXED,
                flag=UI.EXPAND | UI.LEFT | UI.RIGHT)
     sizerV.Add(self.pay,
                proportion=FIXED,
                flag=UI.EXPAND | UI.LEFT | UI.RIGHT)
     # sizerH.Add((AUTO, AUTO), proportion=AUTO, flag=UI.EXPAND|UI.ALL) # FIXME: WX3.0 has no Add(int,int,proportion=0,flag=0) compatible
     sizerH.Add(AUTO, AUTO, proportion=AUTO, flag=UI.EXPAND | UI.ALL)
     sizerH.Add(sizerV, proportion=FIXED, flag=UI.EXPAND | UI.ALL)
     sizerH.Add((AUTO, AUTO), proportion=AUTO, flag=UI.EXPAND | UI.ALL)
     self.sizer.Add(sizerH, proportion=AUTO, flag=UI.EXPAND | UI.ALL)
     self.SetSizerAndFit(self.sizer)
     self.search.ShowCancelButton(True)
     self.search.Bind(UI.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel)
     self.search.Bind(UI.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearch)
     self.search.Bind(UI.EVT_TEXT_ENTER, self.OnSearch)
     self.pay.Disable()
     self.pay.Bind(UI.EVT_BUTTON, self.OnPay)
     self.keyword = None
     self.dx = 0.00
     self.tc = 0.00
     self.yh = 1.00
     self.total = 0.00
     self.Bind(UI.EVT_CHECKBOX, self.OnCheckBox)
     radioBoxTC.Bind(UI.EVT_RADIOBOX, self.OnRadioBoxTC)
     radioBoxYH.Bind(UI.EVT_RADIOBOX, self.OnRadioBoxYH)
Exemplo n.º 20
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)

        # URL输入框
        self.method_choice = wx.Choice(self,
                                       -1,
                                       size=(80, -1),
                                       choices=[u'GET', u'POST'])
        self.method_choice.SetSelection(0)
        self.url_text = wx.TextCtrl(self, -1)
        url_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "URL"))
        url_sizer.Add(self.method_choice, 0)
        url_sizer.Add(self.url_text, 1, wx.EXPAND | wx.LEFT, 2)

        # 参数
        self.post_params_text = wx.TextCtrl(self,
                                            -1,
                                            size=(-1, 150),
                                            style=wx.TE_MULTILINE | wx.HSCROLL)
        post_params_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, -1, "Post Params"), wx.VERTICAL)
        post_params_sizer.Add(self.post_params_text, 1, wx.EXPAND | wx.TOP, 5)

        # 请求头
        self.headers_text = wx.TextCtrl(self,
                                        -1,
                                        size=(-1, 150),
                                        style=wx.TE_MULTILINE | wx.HSCROLL)
        headers_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Headers"))
        headers_sizer.Add(self.headers_text, 1, wx.EXPAND)

        # 输出模板
        self.template_choice = wx.Choice(self, -1, size=(150, -1), choices=[])
        template_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Template"))
        template_sizer.Add(self.template_choice, 1, wx.EXPAND)

        # 返回数据中的域指定
        self.slice_text = wx.TextCtrl(self, -1)
        slice_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, -1, "Response slice startswith"))
        slice_sizer.Add(self.slice_text, 1, wx.EXPAND)

        # 按钮
        self.transform_button = wx.Button(self,
                                          -1,
                                          u'Only Transform',
                                          size=(130, 30))
        self.request_transform_button = wx.Button(self,
                                                  -1,
                                                  u'Request And Transform',
                                                  size=(170, 30))
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        button_sizer.Add((0, 0), 1)
        button_sizer.Add(self.transform_button, 0)
        button_sizer.Add(self.request_transform_button, 0)

        main_box = wx.BoxSizer(wx.VERTICAL)
        main_box.Add(url_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
        main_box.Add(post_params_sizer, 0,
                     wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
        main_box.Add(headers_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                     5)
        main_box.Add(template_sizer, 0,
                     wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
        main_box.Add(slice_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                     5)
        main_box.Add(button_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                     5)
        self.SetSizer(main_box)

        self.preload_templates()

        self.Bind(wx.EVT_BUTTON, self.on_request_transform_button_click,
                  self.request_transform_button)
        self.Bind(wx.EVT_BUTTON, self.on_transform_button_click,
                  self.transform_button)
Exemplo n.º 21
0
    def _do_layout(self):
        """!Options dialog layout
        """
        sizer = wx.BoxSizer(wx.VERTICAL)

        box = wx.StaticBox(parent=self,
                           id=wx.ID_ANY,
                           label=" %s " % _("Plot settings"))
        boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)

        self.wxId['pcolor'] = 0
        self.wxId['pwidth'] = 0
        self.wxId['pstyle'] = 0
        self.wxId['psize'] = 0
        self.wxId['ptype'] = 0
        self.wxId['pfill'] = 0
        self.wxId['plegend'] = 0
        self.wxId['marker'] = {}
        self.wxId['x-axis'] = {}
        self.wxId['y-axis'] = {}

        #
        # plot line settings and point settings
        #
        if len(self.rasterList) == 0: return

        box = wx.StaticBox(parent=self,
                           id=wx.ID_ANY,
                           label=_("Map/image plotted"))
        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)

        row = 0
        choicelist = []
        for i in self.rasterList:
            choicelist.append(str(i))

        self.mapchoice = wx.Choice(parent=self,
                                   id=wx.ID_ANY,
                                   size=(300, -1),
                                   choices=choicelist)
        self.mapchoice.SetToolTipString(_("Settings for selected map"))

        if not self.map:
            self.map = self.rasterList[self.mapchoice.GetCurrentSelection()]
        else:
            self.mapchoice.SetStringSelection(str(self.map))

        gridSizer.Add(item=self.mapchoice,
                      flag=wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 0),
                      span=(1, 2))

        #
        # options for profile
        #
        row += 1
        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Line color"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
        color = csel.ColourSelect(parent=self,
                                  id=wx.ID_ANY,
                                  colour=self.raster[self.map]['pcolor'])
        self.wxId['pcolor'] = color.GetId()
        gridSizer.Add(item=color, pos=(row, 1))

        row += 1
        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Line width"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
        width = wx.SpinCtrl(parent=self,
                            id=wx.ID_ANY,
                            value="",
                            size=(50, -1),
                            style=wx.SP_ARROW_KEYS)
        width.SetRange(1, 10)
        width.SetValue(self.raster[self.map]['pwidth'])
        self.wxId['pwidth'] = width.GetId()
        gridSizer.Add(item=width, pos=(row, 1))

        row += 1
        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Line style"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
        style = wx.Choice(parent=self,
                          id=wx.ID_ANY,
                          size=(120, -1),
                          choices=self.linestyledict.keys())
        style.SetStringSelection(self.raster[self.map]['pstyle'])
        self.wxId['pstyle'] = style.GetId()
        gridSizer.Add(item=style, pos=(row, 1))

        row += 1
        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Legend"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
        legend = wx.TextCtrl(parent=self,
                             id=wx.ID_ANY,
                             value="",
                             size=(200, -1))
        legend.SetValue(self.raster[self.map]['plegend'])
        gridSizer.Add(item=legend, pos=(row, 1))
        self.wxId['plegend'] = legend.GetId()

        boxSizer.Add(item=gridSizer)
        boxMainSizer.Add(item=boxSizer, flag=wx.ALL, border=3)

        #
        # segment marker settings for profiles
        #
        box = wx.StaticBox(parent=self,
                           id=wx.ID_ANY,
                           label=" %s " %
                           _("Transect segment marker settings"))

        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Color"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
        ptcolor = csel.ColourSelect(parent=self,
                                    id=wx.ID_ANY,
                                    colour=self.properties['marker']['color'])
        self.wxId['marker']['color'] = ptcolor.GetId()
        gridSizer.Add(item=ptcolor, pos=(0, 1))

        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Size"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
        ptsize = wx.SpinCtrl(parent=self,
                             id=wx.ID_ANY,
                             value="",
                             size=(50, -1),
                             style=wx.SP_ARROW_KEYS)
        ptsize.SetRange(1, 10)
        ptsize.SetValue(self.properties['marker']['size'])
        self.wxId['marker']['size'] = ptsize.GetId()
        gridSizer.Add(item=ptsize, pos=(1, 1))

        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Fill"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
        ptfill = wx.Choice(parent=self,
                           id=wx.ID_ANY,
                           size=(120, -1),
                           choices=self.ptfilldict.keys())
        ptfill.SetStringSelection(self.properties['marker']['fill'])
        self.wxId['marker']['fill'] = ptfill.GetId()
        gridSizer.Add(item=ptfill, pos=(2, 1))

        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Legend"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(3, 0))
        ptlegend = wx.TextCtrl(parent=self,
                               id=wx.ID_ANY,
                               value="",
                               size=(200, -1))
        ptlegend.SetValue(self.properties['marker']['legend'])
        self.wxId['marker']['legend'] = ptlegend.GetId()
        gridSizer.Add(item=ptlegend, pos=(3, 1))

        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Style"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(4, 0))
        pttype = wx.Choice(parent=self,
                           size=(200, -1),
                           choices=self.pttypelist)
        pttype.SetStringSelection(self.properties['marker']['type'])
        self.wxId['marker']['type'] = pttype.GetId()
        gridSizer.Add(item=pttype, pos=(4, 1))

        boxSizer.Add(item=gridSizer)
        boxMainSizer.Add(item=boxSizer, flag=wx.ALL, border=3)

        sizer.Add(item=boxMainSizer, flag=wx.ALL | wx.EXPAND, border=3)

        #
        # axis options for all plots
        #
        box = wx.StaticBox(parent=self,
                           id=wx.ID_ANY,
                           label=" %s " % _("Axis settings"))
        boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)

        middleSizer = wx.BoxSizer(wx.HORIZONTAL)

        idx = 0
        for axis, atype in [(_("X-Axis"), 'x-axis'), (_("Y-Axis"), 'y-axis')]:
            box = wx.StaticBox(parent=self, id=wx.ID_ANY, label=" %s " % axis)
            boxSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
            gridSizer = wx.GridBagSizer(vgap=5, hgap=5)

            prop = self.properties[atype]['prop']

            row = 0
            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Scale"))
            gridSizer.Add(item=label,
                          flag=wx.ALIGN_CENTER_VERTICAL,
                          pos=(row, 0))
            type = wx.Choice(parent=self,
                             id=wx.ID_ANY,
                             size=(100, -1),
                             choices=self.axislist)
            type.SetStringSelection(prop['type'])
            type.SetToolTipString(
                _("Automatic axis scaling, custom max and min, or scale matches data range (min)"
                  ))
            self.wxId[atype]['type'] = type.GetId()
            gridSizer.Add(item=type, pos=(row, 1))

            row += 1
            label = wx.StaticText(parent=self,
                                  id=wx.ID_ANY,
                                  label=_("Custom min"))
            gridSizer.Add(item=label,
                          flag=wx.ALIGN_CENTER_VERTICAL,
                          pos=(row, 0))
            min = wx.TextCtrl(parent=self,
                              id=wx.ID_ANY,
                              value="",
                              size=(70, -1))
            min.SetValue(str(prop['min']))
            self.wxId[atype]['min'] = min.GetId()
            gridSizer.Add(item=min, pos=(row, 1))

            row += 1
            label = wx.StaticText(parent=self,
                                  id=wx.ID_ANY,
                                  label=_("Custom max"))
            gridSizer.Add(item=label,
                          flag=wx.ALIGN_CENTER_VERTICAL,
                          pos=(row, 0))
            max = wx.TextCtrl(parent=self,
                              id=wx.ID_ANY,
                              value="",
                              size=(70, -1))
            max.SetValue(str(prop['max']))
            self.wxId[atype]['max'] = max.GetId()
            gridSizer.Add(item=max, pos=(row, 1))

            row += 1
            log = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_("Log scale"))
            log.SetValue(prop['log'])
            self.wxId[atype]['log'] = log.GetId()
            gridSizer.Add(item=log, pos=(row, 0), span=(1, 2))

            if idx == 0:
                flag = wx.ALL | wx.EXPAND
            else:
                flag = wx.TOP | wx.BOTTOM | wx.RIGHT | wx.EXPAND

            boxSizer.Add(item=gridSizer, flag=wx.ALL, border=3)
            boxMainSizer.Add(item=boxSizer, flag=flag, border=3)

            idx += 1

        middleSizer.Add(item=boxMainSizer, flag=wx.ALL | wx.EXPAND, border=3)

        #
        # grid & legend options for all plots
        #
        self.wxId['grid'] = {}
        self.wxId['legend'] = {}
        self.wxId['font'] = {}
        box = wx.StaticBox(parent=self,
                           id=wx.ID_ANY,
                           label=" %s " % _("Grid and Legend settings"))
        boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)

        row = 0
        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Grid color"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
        gridcolor = csel.ColourSelect(parent=self,
                                      id=wx.ID_ANY,
                                      colour=self.properties['grid']['color'])
        self.wxId['grid']['color'] = gridcolor.GetId()
        gridSizer.Add(item=gridcolor, pos=(row, 1))

        row += 1
        gridshow = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_("Show grid"))
        gridshow.SetValue(self.properties['grid']['enabled'])
        self.wxId['grid']['enabled'] = gridshow.GetId()
        gridSizer.Add(item=gridshow, pos=(row, 0), span=(1, 2))

        row += 1
        label = wx.StaticText(parent=self,
                              id=wx.ID_ANY,
                              label=_("Legend font size"))
        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
        legendfontsize = wx.SpinCtrl(parent=self,
                                     id=wx.ID_ANY,
                                     value="",
                                     size=(50, -1),
                                     style=wx.SP_ARROW_KEYS)
        legendfontsize.SetRange(5, 100)
        legendfontsize.SetValue(
            int(self.properties['font']['prop']['legendSize']))
        self.wxId['font']['legendSize'] = legendfontsize.GetId()
        gridSizer.Add(item=legendfontsize, pos=(row, 1))

        row += 1
        legendshow = wx.CheckBox(parent=self,
                                 id=wx.ID_ANY,
                                 label=_("Show legend"))
        legendshow.SetValue(self.properties['legend']['enabled'])
        self.wxId['legend']['enabled'] = legendshow.GetId()
        gridSizer.Add(item=legendshow, pos=(row, 0), span=(1, 2))

        boxMainSizer.Add(item=gridSizer, flag=flag, border=3)

        middleSizer.Add(item=boxMainSizer,
                        flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
                        border=3)

        sizer.Add(item=middleSizer, flag=wx.ALL, border=0)

        #
        # line & buttons
        #
        line = wx.StaticLine(parent=self,
                             id=wx.ID_ANY,
                             size=(20, -1),
                             style=wx.LI_HORIZONTAL)
        sizer.Add(item=line,
                  proportion=0,
                  flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                  border=3)

        #
        # buttons
        #
        btnSave = wx.Button(self, wx.ID_SAVE)
        btnApply = wx.Button(self, wx.ID_APPLY)
        btnOk = wx.Button(self, wx.ID_OK)
        btnCancel = wx.Button(self, wx.ID_CANCEL)
        btnOk.SetDefault()

        # tooltips for buttons
        btnApply.SetToolTipString(_("Apply changes for the current session"))
        btnOk.SetToolTipString(
            _("Apply changes for the current session and close dialog"))
        btnSave.SetToolTipString(
            _("Apply and save changes to user settings file (default for next sessions)"
              ))
        btnCancel.SetToolTipString(_("Close dialog and ignore changes"))

        # sizers
        btnStdSizer = wx.StdDialogButtonSizer()
        btnStdSizer.AddButton(btnOk)
        btnStdSizer.AddButton(btnApply)
        btnStdSizer.AddButton(btnCancel)
        btnStdSizer.Realize()

        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        btnSizer.Add(item=btnSave,
                     proportion=0,
                     flag=wx.ALIGN_LEFT | wx.ALL,
                     border=5)
        btnSizer.Add(item=btnStdSizer,
                     proportion=0,
                     flag=wx.ALIGN_RIGHT | wx.ALL,
                     border=5)
        sizer.Add(item=btnSizer,
                  proportion=0,
                  flag=wx.ALIGN_RIGHT | wx.ALL,
                  border=5)

        #
        # bindings for buttons and map plot settings controls
        #
        self.mapchoice.Bind(wx.EVT_CHOICE, self.OnSetMap)

        # bindings
        btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
        btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
        btnOk.SetDefault()
        btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
        btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)

        self.SetSizer(sizer)
        sizer.Fit(self)
    def __init__(self, parent):
        wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE)
        self.parent = parent
        self.selection = True

        # Type
        self.box_type_staticbox = wx.StaticBox(self, -1, _(u"Type"))
        self.radio_type_prestations = wx.RadioButton(self,
                                                     -1,
                                                     _(u"Prestations"),
                                                     style=wx.RB_GROUP)
        self.radio_type_factures = wx.RadioButton(self, -1, _(u"Factures"))

        # Options
        self.box_options_staticbox = wx.StaticBox(self, -1, _(u"Options"))
        self.check_impayes = wx.CheckBox(self, -1,
                                         _(u"Uniquement les impayés"))
        self.check_conso = wx.CheckBox(self, -1,
                                       _(u"Détailler les consommations"))
        self.check_regroupement = wx.CheckBox(self, -1, _(u"Regrouper par"))
        self.ctrl_regroupement_date = wx.Choice(
            self, -1, choices=["Date", _(u"Mois"),
                               _(u"Année")])

        # Période
        self.box_periode_staticbox = wx.StaticBox(self, -1, _(u"Période"))
        self.radio_tout = wx.RadioButton(self,
                                         -1,
                                         _(u"Toutes les périodes"),
                                         style=wx.RB_GROUP)
        self.radio_dates = wx.RadioButton(self, -1, u"Du")
        self.ctrl_date_debut = CTRL_Saisie_date.Date2(self)
        self.label_au = wx.StaticText(self, -1, _(u"au"))
        self.ctrl_date_fin = CTRL_Saisie_date.Date2(self)
        self.radio_apartirde = wx.RadioButton(self, -1, _(u"A partir du"))
        self.ctrl_date_apartirde = CTRL_Saisie_date.Date2(self)
        self.radio_jusquau = wx.RadioButton(self, -1, _(u"Jusqu'au"))
        self.ctrl_date_jusquau = CTRL_Saisie_date.Date2(self)
        self.radio_mois = wx.RadioButton(self, -1, _(u"Mois de"))
        self.ctrl_mois = wx.Choice(self,
                                   -1,
                                   choices=[
                                       _(u"Janvier"),
                                       _(u"Février"),
                                       _(u"Mars"),
                                       _(u"Avril"),
                                       _(u"Mai"),
                                       _(u"Juin"),
                                       _(u"Juillet"),
                                       _(u"Août"),
                                       _(u"Septembre"),
                                       _(u"Octobre"),
                                       _(u"Novembre"),
                                       _(u"Décembre")
                                   ])
        self.ctrl_mois_annee = wx.SpinCtrl(self,
                                           -1,
                                           str(datetime.date.today().year),
                                           min=1900,
                                           max=2099)
        self.radio_annee = wx.RadioButton(self, -1, _(u"Année"))
        self.ctrl_annee = wx.SpinCtrl(self, -1, u"2012", min=1900, max=2099)
        self.radio_vacances = wx.RadioButton(self, -1, _(u"Vacances de"))
        self.ctrl_vacances = wx.Choice(self,
                                       -1,
                                       choices=[
                                           _(u"Février"),
                                           _(u"Pâques"),
                                           _(u"Eté"),
                                           _(u"Toussaint"),
                                           _(u"Noël")
                                       ])
        self.ctrl_vacances_annee = wx.SpinCtrl(self,
                                               -1,
                                               u"2012",
                                               min=1900,
                                               max=2099)

        # Boutons
        self.bouton_aide = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png")
        self.bouton_ok = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Ok"), cheminImage="Images/32x32/Valider.png")
        self.bouton_annuler = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png")

        self.__set_properties()
        self.__do_layout()

        # Binds
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioType,
                  self.radio_type_prestations)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioType,
                  self.radio_type_factures)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPeriode, self.radio_tout)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPeriode, self.radio_dates)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPeriode,
                  self.radio_apartirde)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPeriode, self.radio_jusquau)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPeriode, self.radio_mois)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPeriode, self.radio_annee)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioPeriode, self.radio_vacances)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler)

        # Init Contrôles
        self.dictVacances = self.GetListeVacances()
        self.OnRadioType(None)
        self.OnRadioPeriode(None)
Exemplo n.º 23
0
    def Action(self):

        # Set a background for the UI
        ui_bitmap = wx.Image("PROGRAM_INSTALL_FULLPATH\\background.jpg",
                             wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        self.under = wx.StaticBitmap(self, -1, ui_bitmap, (0, 0))

        # Image Banner
        banner_bitmap1 = wx.Bitmap("PROGRAM_INSTALL_FULLPATH\\ResNet.png")
        banner_image1 = banner_bitmap1.ConvertToImage()
        banner_image1 = banner_image1.Scale(285, 200, wx.IMAGE_QUALITY_HIGH)
        banner_bitmap2 = banner_image1.ConvertToBitmap()
        ui_banner_bitmap = wx.StaticBitmap(self, -1, banner_bitmap2, (0, 2))

        # The Left menu below the banner, which contains the File dialog button, report text box and about button
        left_menu = wx.StaticBox(self.under, -1, "")
        left_menu.SetSize((285, 370))
        left_menu.SetPosition((0, 200))
        left_menu.SetBackgroundColour(wx.WHITE)

        # The right region to display the picture selected from the dialog.
        right_region = wx.StaticBox(self, -1, "Picture")
        right_region.SetSize((650, 510))
        right_region.SetBackgroundColour(wx.WHITE)
        right_region.SetPosition((300, 10))
        self.magic_collection.append(
            right_region
        )  # Adding the right region object to the UI object array

        # The report text box, to report prediction results
        report_box = wx.TextCtrl(
            left_menu,
            -1, "1. Click the Button Above \n \n"
            "2.Select your picture. \n \n"
            "3. Wait till the Program studies the picture and display the result here",
            size=(285, 200),
            style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER,
            pos=(5, 80))
        font = wx.Font(10, wx.DECORATIVE, wx.NORMAL, wx.NORMAL)
        report_box.SetFont(font)

        self.magic_collection.append(
            report_box)  # Adding the report text box to the UI objects array

        # A Sample picture in the right region
        modification_bitmap1 = wx.Bitmap(
            "PROGRAM_INSTALL_FULLPATH\\sample.jpg")
        modification_image1 = modification_bitmap1.ConvertToImage()
        modification_image1 = modification_image1.Scale(
            650, 490, wx.IMAGE_QUALITY_HIGH)
        modification_bitmap2 = modification_image1.ConvertToBitmap()
        report_bitmap = wx.StaticBitmap(right_region, -1, modification_bitmap2,
                                        (0, 20))
        self.magic_collection.append(report_bitmap)

        # Text label
        image_dialog_label = wx.StaticText(left_menu, -1, "Select Picture")
        image_dialog_label.SetPosition((20, 20))
        image_dialog_label.SetForegroundColour(wx.BLUE)
        image_dialog_label.SetBackgroundColour(wx.WHITE)

        # The button to call the file dialog function
        dialog_button = wx.Button(left_menu, -1, "Click to Select")
        dialog_button.SetPosition((20, 40))
        dialog_button.SetSize((120, 30))
        dialog_button_bitmap = wx.Bitmap(
            "PROGRAM_INSTALL_FULLPATH\\select-file.png")
        dialog_button_bitmap_pressed = wx.Bitmap(
            "PROGRAM_INSTALL_FULLPATH\\select-file-hover.png")
        dialog_button.SetBitmap(dialog_button_bitmap, wx.LEFT)
        dialog_button.SetBitmapPressed(dialog_button_bitmap_pressed)
        self.Bind(wx.EVT_BUTTON, self.launchFileDialog, dialog_button)

        # The button to call the About ResNet dialog
        about_resnet = wx.Button(left_menu, -1, "About ResNet")
        about_resnet.SetPosition((20, 285))
        about_resnet.SetSize((200, 30))
        about_resnet_bitmap = wx.Bitmap("PROGRAM_INSTALL_FULLPATH\\info.png")
        about_resnet.SetBitmap(about_resnet_bitmap, wx.LEFT)
        self.Bind(wx.EVT_BUTTON, self.aboutResnet, about_resnet)

        # The button to call the About dialog
        about_button = wx.Button(left_menu, -1, "About ResNet Playground")
        about_button.SetPosition((20, 320))
        about_button.SetSize((200, 30))
        about_button_bitmap = wx.Bitmap("PROGRAM_INSTALL_FULLPATH\\info.png")
        about_button.SetBitmap(about_button_bitmap, wx.LEFT)
        self.Bind(wx.EVT_BUTTON, self.aboutApplication, about_button)
Exemplo n.º 24
0
  def __init__(self,parent,id):
    wx.Panel.__init__(self,parent,id,size=(1150,400))
    self.theCurrentEnvironment = -1
    b = Borg()
    self.dbProxy = b.dbProxy
    directoryPrefix = b.iconDir + '/'
    environmentModelBmp = wx.Image(directoryPrefix + 'environmentModel.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    assetModelBmp = wx.Image(directoryPrefix + 'classModel.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    goalModelBmp = wx.Image(directoryPrefix + 'goalModel.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    obstacleModelBmp = wx.Image(directoryPrefix + 'obstacleModel.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    responsibilityModelBmp = wx.Image(directoryPrefix + 'responsibilityModel.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    taskModelBmp = wx.Image(directoryPrefix + 'taskModel.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    apModelBmp = wx.Image(directoryPrefix + 'apModel.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    atModelBmp = wx.Image(directoryPrefix + 'atModel.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    classAssociationsBmp = wx.Image(directoryPrefix + 'classassociation.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    dependenciesBmp = wx.Image(directoryPrefix + 'dependencyassociation.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    goalAssociationsBmp = wx.Image(directoryPrefix + 'goalassociation.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    cmModelBmp = wx.Image(directoryPrefix + 'conceptMapModel.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    componentModelBmp = wx.Image(directoryPrefix + 'component_view.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    locationViewBmp = wx.Image(directoryPrefix + 'location_view.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()

    self.visToolbar = wx.ToolBar(self,style=wx.TB_HORIZONTAL | wx.TB_DOCKABLE)
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_DEPENDENCIES,dependenciesBmp,'Edit Dependencies')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_GOALASSOCIATIONS,goalAssociationsBmp,'Edit Goal Associations')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_CLASSASSOCIATIONS,classAssociationsBmp,'Edit Asset Associations')
    self.visToolbar.AddSeparator()
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_ENVIRONMENTMODEL,environmentModelBmp,'View Risk Analysis Model')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_GOALMODEL,goalModelBmp,'View Goal Model')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_OBSTACLEMODEL,obstacleModelBmp,'View Obstacle Model')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_RESPONSIBILITYMODEL,responsibilityModelBmp,'View Responsibility Model')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_ASSETMODEL,assetModelBmp,'View Asset Model')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_TASKMODEL,taskModelBmp,'View Task Model')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_APMODEL,apModelBmp,'View Assumption Persona Model')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_ATMODEL,atModelBmp,'View Assumption Task Model')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_CMMODEL,cmModelBmp,'View Concept Map Model')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_COMPONENTMODEL,componentModelBmp,'View Component Model')
    self.visToolbar.AddSimpleTool(RMFRAME_TOOL_LOCATIONMODEL,locationViewBmp,'View Location Model')

    self.visToolbar.Realize()

    self.sizer = wx.BoxSizer(wx.VERTICAL)
    reqMods = ['']
    reqMods += self.dbProxy.getDimensionNames(self.objectDimension)
    reqMods.sort()
    envMods = [''] + self.dbProxy.getDimensionNames('environment')
    envMods.sort()
    filterSizer = wx.BoxSizer(wx.HORIZONTAL)
    self.sizer.Add(filterSizer,0,wx.EXPAND)

    modBox = wx.StaticBox(self,-1,self.objectLabel)
    modSizer = wx.StaticBoxSizer(modBox,wx.HORIZONTAL)
    if len(reqMods) == 0:
      self.modCombo = wx.ComboBox(self,RMFRAME_TOOL_COMBOOBJECT,'',choices=[],size=(200,-1),style=wx.CB_DROPDOWN)
    else:
      self.modCombo = wx.ComboBox(self,RMFRAME_TOOL_COMBOOBJECT,reqMods[0],choices=reqMods,size=(200,-1),style=wx.CB_DROPDOWN)
    modSizer.Add(self.modCombo,0,wx.EXPAND)
    filterSizer.Add(modSizer,0,wx.ALL | wx.ALIGN_LEFT,4)

    envBox = wx.StaticBox(self,-1,'Environments')
    envSizer = wx.StaticBoxSizer(envBox,wx.HORIZONTAL)
    if len(envMods) == 0:
      self.envCombo = wx.ComboBox(self,RMFRAME_TOOL_COMBOENVIRONMENT,'',choices=[],size=(200,-1),style=wx.CB_DROPDOWN)
    else:
      self.envCombo = wx.ComboBox(self,RMFRAME_TOOL_COMBOENVIRONMENT,envMods[0],choices=envMods,size=(200,-1),style=wx.CB_DROPDOWN)
    envSizer.Add(self.envCombo,0,wx.EXPAND)
    filterSizer.Add(envSizer,0,wx.ALL | wx.ALIGN_LEFT,4)
    filterSizer.Add(self.visToolbar,0,wx.ALL | wx.ALIGN_LEFT,4)
    
    filteredReqMods = filter(None, reqMods)
    filteredEnvMods = filter(None, envMods)
    if len(filteredReqMods) > 0:
      self.modCombo.SetStringSelection(filteredReqMods[0])
    else:
      if len(filteredEnvMods) > 0:
        self.envCombo.SetStringSelection(filteredEnvMods[0])
Exemplo n.º 25
0
    def __init__(self, *args, **kw):
        Panel_API_graphique.__init__(self, *args, **kw)

        self.canvas.fixe = True

        #self.couleurs = u"bgrmkcy"
        #        self.couleurs = [(0, 1, 0), (.5, .5, 0), (1, 0, 0),
        #                         (.5, 0, .5), (0, 0, 1), (0, .5, .5)]
        self.couleurs = [
            [0.0, 0.0, 0.5],
            #[0.0, 0.0, 0.68939393939393945],
            #[0.0, 0.0, 0.87878787878787878],
            #[0.0, 0.0, 1.0],
            #[0.0, 0.16666666666666663, 1.0],
            [0.0, 0.33333333333333326, 1.0],
            #[0.0, 0.5, 1.0],
            #[0.0, 0.66666666666666652, 1.0],
            [0.0, 0.83333333333333326, 1.0],
            [0.080645161290322731, 1.0, 0.88709677419354827],
            #[0.21505376344086025, 1.0, 0.75268817204301075],
            #[0.34946236559139776, 1.0, 0.61827956989247301],
            [0.4838709677419355, 1.0, 0.48387096774193528],
            #[0.61827956989247301, 1.0, 0.34946236559139776],
            #[0.75268817204301053, 1.0, 0.21505376344086025],
            [0.88709677419354827, 1.0, 0.080645161290322509],
            #[1.0, 0.90123456790123502, 0.0],
            [1.0, 0.82, 0.0],
            #[1.0, 0.74691358024691423, 0.0],
            [1.0, 0.59259259259259256, 0.0],
            #[1.0, 0.43827160493827177, 0.0],
            [1.0, 0.28395061728395099, 0.0],
            #[1.0, 0.12962962962962976, 0.0],
            [0.8787878787878789, 0.0, 0.0],
            [0.68939393939393945, 0.0, 0.0],
            [0.5, 0, 0],
        ]
        self._Z = None

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

        box = wx.StaticBox(self, -1, u"Equation")
        ligne = wx.StaticBoxSizer(box, wx.HORIZONTAL)
        ligne.Add(wx.StaticText(self, -1, "Z = "), 0, wx.ALIGN_CENTRE | wx.ALL,
                  5)
        self.equation = wx.TextCtrl(self,
                                    size=(160, -1),
                                    style=wx.TE_PROCESS_ENTER)
        self.equation.Bind(wx.EVT_CHAR, self.EvtChar)
        ligne.Add(self.equation, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        self.entrees.Add(ligne, 0, wx.ALL, 5)

        box = wx.StaticBox(self, -1, u"Abscisse")
        liste = wx.StaticBoxSizer(box, wx.VERTICAL)

        ligne = wx.BoxSizer(wx.HORIZONTAL)
        ligne.Add(wx.StaticText(self, -1, "Xmin"), 0, wx.ALIGN_CENTRE | wx.ALL,
                  5)
        self.xmin = wx.TextCtrl(self,
                                value="-5",
                                size=(160, -1),
                                style=wx.TE_PROCESS_ENTER)
        self.xmin.Bind(wx.EVT_CHAR, self.EvtChar)
        ligne.Add(self.xmin, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        liste.Add(ligne, 0, wx.ALL, 5)

        ligne = wx.BoxSizer(wx.HORIZONTAL)
        ligne.Add(wx.StaticText(self, -1, u"Xmax"), 0,
                  wx.ALIGN_CENTRE | wx.ALL, 5)
        self.xmax = wx.TextCtrl(self,
                                value="5",
                                size=(160, -1),
                                style=wx.TE_PROCESS_ENTER)
        self.xmax.Bind(wx.EVT_CHAR, self.EvtChar)
        ligne.Add(self.xmax, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        liste.Add(ligne, 0, wx.ALL, 5)

        ligne = wx.BoxSizer(wx.HORIZONTAL)
        ligne.Add(wx.StaticText(self, -1, u"Pas"), 0, wx.ALIGN_CENTRE | wx.ALL,
                  5)
        self.pasX = wx.TextCtrl(self,
                                value="",
                                size=(160, -1),
                                style=wx.TE_PROCESS_ENTER)
        self.pasX.Bind(wx.EVT_CHAR, self.EvtChar)
        ligne.Add(self.pasX, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        liste.Add(ligne, 0, wx.ALL, 5)

        self.entrees.Add(liste, 0, wx.ALL, 5)

        box = wx.StaticBox(self, -1, u"Ordonnée")
        liste = wx.StaticBoxSizer(box, wx.VERTICAL)

        ligne = wx.BoxSizer(wx.HORIZONTAL)
        ligne.Add(wx.StaticText(self, -1, u"Ymin"), 0,
                  wx.ALIGN_CENTRE | wx.ALL, 5)
        self.ymin = wx.TextCtrl(self,
                                value="-5",
                                size=(160, -1),
                                style=wx.TE_PROCESS_ENTER)
        self.ymin.Bind(wx.EVT_CHAR, self.EvtChar)
        ligne.Add(self.ymin, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        liste.Add(ligne, 0, wx.ALL, 5)

        ligne = wx.BoxSizer(wx.HORIZONTAL)
        ligne.Add(wx.StaticText(self, -1, u"Ymax"), 0,
                  wx.ALIGN_CENTRE | wx.ALL, 5)
        self.ymax = wx.TextCtrl(self,
                                value="5",
                                size=(160, -1),
                                style=wx.TE_PROCESS_ENTER)
        self.ymax.Bind(wx.EVT_CHAR, self.EvtChar)
        ligne.Add(self.ymax, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        liste.Add(ligne, 0, wx.ALL, 5)

        ligne = wx.BoxSizer(wx.HORIZONTAL)
        ligne.Add(wx.StaticText(self, -1, u"Pas"), 0, wx.ALIGN_CENTRE | wx.ALL,
                  5)
        self.pasY = wx.TextCtrl(self,
                                value="",
                                size=(160, -1),
                                style=wx.TE_PROCESS_ENTER)
        self.pasY.Bind(wx.EVT_CHAR, self.EvtChar)
        ligne.Add(self.pasY, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        liste.Add(ligne, 0, wx.ALL, 5)

        self.entrees.Add(liste, 0, wx.ALL, 5)

        box = wx.StaticBox(self, -1, u"Seuils")
        liste = wx.StaticBoxSizer(box, wx.VERTICAL)

        ligne = wx.BoxSizer(wx.HORIZONTAL)
        #        ligne.Add(wx.StaticText(self, -1, u"Pas"), 0, wx.ALIGN_CENTRE|wx.ALL,5)
        self.seuils = wx.TextCtrl(self,
                                  size=(160, -1),
                                  style=wx.TE_PROCESS_ENTER)
        self.seuils.Bind(wx.EVT_CHAR, self.EvtChar)
        ligne.Add(self.seuils, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        liste.Add(ligne, 0, wx.ALL, 5)
        #        liste.Add(wx.StaticText(self, -1, u"Exemple : 0.2 (évitez des valeurs trop faibles)."), 0, wx.ALL, 5)

        self.entrees.Add(liste, 0, wx.ALL, 5)

        #self.dessiner = wx.Button(self, wx.ID_REFRESH)
        #self.entrees.Add(self.dessiner, 0, wx.ALL, 5)
        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.sizer.Add(self.entrees, 0, wx.ALL, 5)
        self.SetSizer(self.sizer)
        self.Fit()
        self.ax3d = MyAxes3D(self.canvas.figure)
        self.plt = self.canvas.figure.axes.append(self.ax3d)
        self.initialisation_terminee = True
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           id=wx.ID_ANY,
                           title=u"Iniciar Campaña",
                           pos=wx.DefaultPosition,
                           size=wx.Size(648, 438),
                           style=wx.DEFAULT_DIALOG_STYLE)

        self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)
        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT))

        gbSizer1 = wx.GridBagSizer(0, 0)
        gbSizer1.SetFlexibleDirection(wx.BOTH)
        gbSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        sbSizer1 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, wx.EmptyString), wx.VERTICAL)

        gbSizer2 = wx.GridBagSizer(0, 0)
        gbSizer2.SetFlexibleDirection(wx.BOTH)
        gbSizer2.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        self.m_staticText1 = wx.StaticText(self, wx.ID_ANY,
                                           u"Fecha de Inicio:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText1.Wrap(-1)
        self.m_staticText1.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer2.Add(self.m_staticText1, wx.GBPosition(0, 0), wx.GBSpan(1, 1),
                     wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.tc_fecha_inicio = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                           wx.DefaultPosition, wx.DefaultSize,
                                           wx.TE_CENTRE | wx.TE_READONLY)
        self.tc_fecha_inicio.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer2.Add(self.tc_fecha_inicio, wx.GBPosition(0, 1),
                     wx.GBSpan(1, 1), wx.TOP | wx.BOTTOM | wx.RIGHT, 5)

        self.m_staticText2 = wx.StaticText(self, wx.ID_ANY, u"Número:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText2.Wrap(-1)
        self.m_staticText2.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer2.Add(
            self.m_staticText2, wx.GBPosition(0, 2), wx.GBSpan(1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.TOP | wx.BOTTOM
            | wx.LEFT, 5)

        self.tc_numero = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                     wx.DefaultPosition, wx.DefaultSize,
                                     wx.TE_CENTRE)
        self.tc_numero.SetFont(wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer2.Add(self.tc_numero, wx.GBPosition(0, 3), wx.GBSpan(1, 1),
                     wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.m_staticText5 = wx.StaticText(self, wx.ID_ANY, u"Usuario:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText5.Wrap(-1)
        self.m_staticText5.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer2.Add(self.m_staticText5, wx.GBPosition(0, 4), wx.GBSpan(1, 1),
                     wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM | wx.LEFT,
                     5)

        self.tc_usuario = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                      wx.DefaultPosition, wx.DefaultSize,
                                      wx.TE_CENTRE | wx.TE_READONLY)
        self.tc_usuario.SetFont(wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer2.Add(self.tc_usuario, wx.GBPosition(0, 5), wx.GBSpan(1, 1),
                     wx.ALL, 5)

        self.m_staticline1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition,
                                           wx.DefaultSize, wx.LI_HORIZONTAL)
        gbSizer2.Add(self.m_staticline1, wx.GBPosition(1, 0), wx.GBSpan(1, 6),
                     wx.EXPAND | wx.ALL, 5)

        self.m_staticText51 = wx.StaticText(self, wx.ID_ANY,
                                            u"Inicio de Reparto:",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText51.Wrap(-1)
        self.m_staticText51.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer2.Add(self.m_staticText51, wx.GBPosition(2, 0), wx.GBSpan(1, 1),
                     wx.TOP | wx.BOTTOM | wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                     5)

        self.tc_ini_reparto = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                          wx.DefaultPosition, wx.DefaultSize,
                                          0)
        self.tc_ini_reparto.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))
        self.tc_ini_reparto.SetToolTipString(u"Fecha de inicio")

        gbSizer2.Add(self.tc_ini_reparto, wx.GBPosition(2, 1), wx.GBSpan(1, 1),
                     wx.TOP | wx.BOTTOM | wx.RIGHT, 5)

        self.m_staticText6 = wx.StaticText(self, wx.ID_ANY,
                                           u"Diferencia con anterior:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText6.Wrap(-1)
        self.m_staticText6.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer2.Add(
            self.m_staticText6, wx.GBPosition(2, 2), wx.GBSpan(1, 2), wx.TOP
            | wx.BOTTOM | wx.LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
            5)

        self.tc_diferencia = wx.TextCtrl(self, wx.ID_ANY, u"0.00",
                                         wx.DefaultPosition, wx.DefaultSize,
                                         wx.TE_RIGHT)
        self.tc_diferencia.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))
        self.tc_diferencia.SetToolTipString(u"Diferencia en pesos")

        gbSizer2.Add(self.tc_diferencia, wx.GBPosition(2, 4), wx.GBSpan(1, 2),
                     wx.ALL, 5)

        sbSizer2 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, wx.EmptyString), wx.VERTICAL)

        gbSizer3 = wx.GridBagSizer(0, 0)
        gbSizer3.SetFlexibleDirection(wx.BOTH)
        gbSizer3.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        self.m_staticText7 = wx.StaticText(
            self, wx.ID_ANY, u"Distribución = (Pedidos a cobrar) x",
            wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText7.Wrap(-1)
        self.m_staticText7.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer3.Add(self.m_staticText7, wx.GBPosition(0, 0), wx.GBSpan(1, 1),
                     wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.tc_parametro = wx.TextCtrl(self, wx.ID_ANY,
                                        u"0", wx.DefaultPosition,
                                        wx.Size(-1, -1), wx.TE_RIGHT)
        self.tc_parametro.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer3.Add(self.tc_parametro, wx.GBPosition(0, 1), wx.GBSpan(1, 1),
                     wx.TOP | wx.BOTTOM | wx.RIGHT, 5)

        self.m_staticText8 = wx.StaticText(self, wx.ID_ANY, u"+",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText8.Wrap(-1)
        self.m_staticText8.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer3.Add(self.m_staticText8, wx.GBPosition(0, 2), wx.GBSpan(1, 1),
                     wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.tc_base = wx.TextCtrl(self, wx.ID_ANY, u"7000.00",
                                   wx.DefaultPosition, wx.DefaultSize,
                                   wx.TE_RIGHT)
        self.tc_base.SetFont(wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer3.Add(self.tc_base, wx.GBPosition(0, 3), wx.GBSpan(1, 1),
                     wx.ALL, 5)

        sbSizer2.Add(gbSizer3, 1, wx.EXPAND, 5)

        gbSizer2.Add(sbSizer2, wx.GBPosition(3, 0), wx.GBSpan(1, 6), wx.EXPAND,
                     5)

        self.m_staticText3 = wx.StaticText(self, wx.ID_ANY, u"Comentario:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText3.Wrap(-1)
        self.m_staticText3.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer2.Add(self.m_staticText3, wx.GBPosition(4, 0), wx.GBSpan(1, 1),
                     wx.ALL, 5)

        self.tc_comentario = wx.TextCtrl(self, wx.ID_ANY,
                                         wx.EmptyString, wx.DefaultPosition,
                                         wx.Size(450, 150), wx.TE_MULTILINE)
        self.tc_comentario.SetMaxLength(700)
        self.tc_comentario.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer2.Add(self.tc_comentario, wx.GBPosition(4, 1), wx.GBSpan(1, 5),
                     wx.TOP | wx.BOTTOM | wx.RIGHT, 5)

        sbSizer1.Add(gbSizer2, 1, wx.EXPAND, 5)

        gbSizer1.Add(sbSizer1, wx.GBPosition(0, 0), wx.GBSpan(1, 6),
                     wx.EXPAND | wx.TOP | wx.BOTTOM | wx.LEFT, 20)

        self.btn_cancelar = wx.Button(self, wx.ID_CANCEL, u"Cancelar",
                                      wx.DefaultPosition, wx.Size(100, 30), 0)
        self.btn_cancelar.SetFont(
            wx.Font(11, 70, 90, 90, False, wx.EmptyString))

        gbSizer1.Add(self.btn_cancelar, wx.GBPosition(1, 5), wx.GBSpan(1, 1),
                     wx.ALIGN_RIGHT | wx.TOP | wx.BOTTOM | wx.LEFT, 10)

        self.btn_aceptar = wx.Button(self, wx.ID_OK, u"Aceptar",
                                     wx.DefaultPosition, wx.Size(100, 30), 0)
        self.btn_aceptar.SetFont(wx.Font(11, 70, 90, 92, False,
                                         wx.EmptyString))

        gbSizer1.Add(
            self.btn_aceptar, wx.GBPosition(1, 4), wx.GBSpan(1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.TOP | wx.BOTTOM
            | wx.LEFT, 5)

        self.SetSizer(gbSizer1)
        self.Layout()

        self.Centre(wx.BOTH)
Exemplo n.º 27
0
    def __init__(self, parent, web_service, **kwargs):
        """Show data from capabilities file.

        Signal: capParsed - this signal is emitted when capabilities file is downloaded
                            (after ConnectToServer method was called)

        :param parent:  parent widget
        :param web_service:  web service to be panel generated for
        """
        wx.Panel.__init__(self, parent = parent, id = wx.ID_ANY)

        self.parent = parent
        self.ws = web_service

        self.capParsed = Signal('WSPanel.capParsed')

        # stores widgets, which represents parameters/flags of d.wms
        self.params = {}
        self.flags = {}

        self.o_layer_name = ''

        # stores err output from r.in.wms during getting capabilities
        self.cmd_err_str = ''

        # stores selected layer from layer list
        self.sel_layers = []

        # downloaded and parsed data from server successfully?
        self.is_connected = False

        # common part of command for r.in.wms -c and d.wms
        self.ws_cmdl = None

        # provides information about driver parameters
        self.drv_info = WMSDriversInfo()
        self.drv_props = self.drv_info.GetDrvProperties(self.ws)

        self.ws_drvs = {
                        'WMS_1.1.1' : {
                                        'cmd' : ['wms_version=1.1.1',
                                                 'driver=WMS_GRASS'],
                                        'cap_parser' : lambda temp_file : WMSCapabilities(temp_file, '1.1.1'),
                                      },
                        'WMS_1.3.0' : {
                                        'cmd' : ['wms_version=1.3.0',
                                                 'driver=WMS_GRASS'],
                                        'cap_parser' : lambda temp_file : WMSCapabilities(temp_file, '1.3.0'),
                                      },
                        'WMTS' :      {
                                        'cmd' : ['driver=WMTS_GRASS'],
                                        'cap_parser' : WMTSCapabilities,
                                      },
                        'OnEarth' : {
                                        'cmd' : ['driver=OnEarth_GRASS'],
                                        'cap_parser' : OnEarthCapabilities,
                                      }
                      }

        self.cmdStdErr = GStderr(self)
        self.cmd_thread = CmdThread(self)
        self.cap_file = grass.tempfile()

        reqDataBox = wx.StaticBox(parent=self, label=_(" Requested data settings "))
        self._nb_sizer = wx.StaticBoxSizer(reqDataBox, wx.VERTICAL)
        self.notebook = GNotebook(parent = self,
                                  style = FN.FNB_FANCY_TABS | FN.FNB_NO_X_BUTTON)

        self._requestPage()
        self._advancedSettsPage()

        self._layout()

        self.layerSelected = self.list.layerSelected

        self.Bind(EVT_CMD_DONE, self.OnCapDownloadDone)
        self.Bind(EVT_CMD_OUTPUT, self.OnCmdOutput)
Exemplo n.º 28
0
    def addGonModelerSettings(self):
        sb = wx.StaticBox(self, -1, 'Measurement')
        sbszmeasure = wx.StaticBoxSizer(sb, wx.VERTICAL)
        sb = wx.StaticBox(self, -1, 'Modeling')
        sbszmodel = wx.StaticBoxSizer(sb, wx.VERTICAL)

        self.widgets['measure axis'] = Choice(self, -1, choices=self.node.axes)
        self.widgets['measure points'] = IntEntry(self, -1, min=2, chars=5)
        self.widgets['measure tolerance'] = FloatEntry(self,
                                                       -1,
                                                       min=0.0,
                                                       chars=5)
        self.widgets['measure interval'] = FloatEntry(self, -1, chars=9)
        self.widgets['measure label'] = Entry(self, -1, chars=12)
        self.widgets['model label'] = Entry(self, -1, chars=12)

        self.widgets['model axis'] = Choice(self, -1, choices=self.node.axes)
        self.widgets['model magnification'] = FloatEntry(self, -1, chars=9)
        self.widgets['model terms'] = IntEntry(self, -1, chars=2)
        self.widgets['model mag only'] = wx.CheckBox(
            self, -1, 'Scale and Rotation Adjustment Only')

        szmeasure = wx.GridBagSizer(5, 5)
        label = wx.StaticText(self, -1, 'Axis:')
        szmeasure.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmeasure.Add(self.widgets['measure axis'], (0, 1), (1, 1),
                      wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
        label = wx.StaticText(self, -1, 'Points:')
        szmeasure.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmeasure.Add(
            self.widgets['measure points'], (1, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
        label = wx.StaticText(self, -1, 'Tolerance:')
        szmeasure.Add(label, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmeasure.Add(
            self.widgets['measure tolerance'], (2, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
        label = wx.StaticText(self, -1, '%')
        szmeasure.Add(label, (2, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        label = wx.StaticText(self, -1, 'Interval')
        szmeasure.Add(label, (3, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmeasure.Add(
            self.widgets['measure interval'], (3, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
        label = wx.StaticText(self, -1, 'Label')
        szmeasure.Add(label, (4, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmeasure.Add(
            self.widgets['measure label'], (4, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
        szmeasure.AddGrowableCol(1)

        sbszmeasure.Add(szmeasure, 1, wx.EXPAND | wx.ALL, 5)

        szmodel = wx.GridBagSizer(5, 5)
        label = wx.StaticText(self, -1, 'Label:')
        szmodel.Add(label, (0, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmodel.Add(
            self.widgets['model label'], (0, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
        label = wx.StaticText(self, -1, 'Axis:')
        szmodel.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmodel.Add(self.widgets['model axis'], (1, 1), (1, 1),
                    wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
        label = wx.StaticText(self, -1, 'Magnification:')
        szmodel.Add(label, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmodel.Add(
            self.widgets['model magnification'], (2, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
        label = wx.StaticText(self, -1, 'Terms:')
        szmodel.Add(label, (3, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szmodel.Add(
            self.widgets['model terms'], (3, 1), (1, 1),
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
        szmodel.Add(self.widgets['model mag only'], (4, 0), (1, 2),
                    wx.ALIGN_CENTER)
        szmodel.AddGrowableCol(1)

        sbszmodel.Add(szmodel, 1, wx.EXPAND | wx.ALL, 5)

        return [sbszmeasure, sbszmodel]
Exemplo n.º 29
0
    def __init__(self, parent, empecheAnnulation=False):
        wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE)
        self.parent = parent
        self.empecheAnnulation = empecheAnnulation

        self.logo = None

        intro = _(
            u"Saisissez ici les informations concernant l'organisateur. Ces données seront utilisées dans les différents documents édités par le logiciel."
        )
        titre = _(u"L'organisateur")
        self.ctrl_bandeau = CTRL_Bandeau.Bandeau(
            self,
            titre=titre,
            texte=intro,
            hauteurHtml=30,
            nomImage="Images/32x32/Organisateur.png")

        self.staticbox_nom_staticbox = wx.StaticBox(
            self, -1, _(u"Nom de l'organisateur"))
        self.label_nom = wx.StaticText(self, -1, _(u"Nom :"))
        self.ctrl_nom = wx.TextCtrl(self, -1, u"")

        self.staticbox_coords_staticbox = wx.StaticBox(self, -1,
                                                       _(u"Coordonnées"))
        self.label_rue = wx.StaticText(self, -1, _(u"Rue :"))
        self.ctrl_rue = wx.TextCtrl(self, -1, u"", style=wx.TE_MULTILINE)
        self.label_adresse = wx.StaticText(self, -1, _(u"C.P. :"))
        self.ctrl_adresse = CTRL_Saisie_adresse.Adresse(self)
        self.label_tel = wx.StaticText(self, -1, _(u"Tél :"))
        self.ctrl_tel = CTRL_Saisie_tel.Tel(self, intitule=_(u"siège"))
        self.label_mail = wx.StaticText(self, -1, _(u"Email :"))
        self.ctrl_mail = CTRL_Saisie_mail.Mail(self)
        self.label_fax = wx.StaticText(self, -1, _(u"Fax :"))
        self.ctrl_fax = CTRL_Saisie_tel.Tel(self, intitule=_(u"fax"))
        self.label_site = wx.StaticText(self, -1, _(u"Site internet :"))
        self.ctrl_site = wx.TextCtrl(self, -1, u"")

        self.staticbox_numeros_staticbox = wx.StaticBox(
            self, -1, _(u"Numéros d'identification"))
        self.label_agrement = wx.StaticText(self, -1,
                                            _(u"Numéro agrément :"))
        self.ctrl_agrement = wx.TextCtrl(self, -1, u"")
        self.label_siret = wx.StaticText(self, -1, _(u"Numéro SIRET :"))
        self.ctrl_siret = wx.TextCtrl(self, -1, u"")
        self.label_ape = wx.StaticText(self, -1, _(u"Code APE :"))
        self.ctrl_ape = wx.TextCtrl(self, -1, u"")

        self.staticbox_logo_staticbox = wx.StaticBox(self, -1, _(u"Logo"))
        self.ctrl_logo = CTRL_Logo.CTRL(self,
                                        qualite=100,
                                        couleurFond=wx.Colour(255, 255, 255),
                                        size=(83, 83))
        self.bouton_modifier = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Modifier.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_supprimer = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Supprimer.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_visualiser = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Loupe.png"),
                      wx.BITMAP_TYPE_ANY))

        self.bouton_aide = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png")
        self.bouton_ok = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Ok"), cheminImage="Images/32x32/Valider.png")
        self.bouton_annuler = CTRL_Bouton_image.CTRL(
            self,
            id=wx.ID_CANCEL,
            texte=_(u"Annuler"),
            cheminImage="Images/32x32/Annuler.png")

        # Empêche l'annulation
        if self.empecheAnnulation == True:
            self.bouton_annuler.Show(False)
            self.EnableCloseButton(False)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonModifierLogo,
                  self.bouton_modifier)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonSupprimerLogo,
                  self.bouton_supprimer)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonVisualiserLogo,
                  self.bouton_visualiser)

        self.Importation()
Exemplo n.º 30
0
    def __init__(self):
        super(printWindow, self).__init__(None, -1, title=_("Printing"))
        t = time.time()
        self.machineCom = None
        self.gcode = None
        self.gcodeList = None
        self.sendList = []
        self.temp = None
        self.bedTemp = None
        self.bufferLineCount = 4
        self.sendCnt = 0
        self.feedrateRatioOuterWall = 1.0
        self.feedrateRatioInnerWall = 1.0
        self.feedrateRatioFill = 1.0
        self.feedrateRatioSupport = 1.0
        self.pause = False
        self.termHistory = []
        self.termHistoryIdx = 0

        self.cam = None

        self.SetSizer(wx.BoxSizer())
        self.panel = wx.Panel(self)
        self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND)
        self.sizer = wx.GridBagSizer(2, 2)
        self.panel.SetSizer(self.sizer)

        sb = wx.StaticBox(self.panel, label=_("Statistics"))
        boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)

        self.powerWarningText = wx.StaticText(
            parent=self.panel,
            id=-1,
            label=
            _("Your computer is running on battery power.\nConnect your computer to AC power or your print might not finish."
              ),
            style=wx.ALIGN_CENTER)
        self.powerWarningText.SetBackgroundColour('red')
        self.powerWarningText.SetForegroundColour('white')
        boxsizer.AddF(self.powerWarningText,
                      flags=wx.SizerFlags().Expand().Border(wx.BOTTOM, 10))
        self.powerManagement = power.PowerManagement()
        self.powerWarningTimer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnPowerWarningChange,
                  self.powerWarningTimer)
        self.OnPowerWarningChange(None)
        self.powerWarningTimer.Start(10000)

        self.statsText = wx.StaticText(
            self.panel, -1,
            _("Filament: ####.##m #.##g\nEstimated print time: #####:##\nMachine state:\nDetecting baudrateXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
              ))
        boxsizer.Add(self.statsText, flag=wx.LEFT, border=5)

        self.sizer.Add(boxsizer, pos=(0, 0), span=(7, 1), flag=wx.EXPAND)

        self.connectButton = wx.Button(self.panel, -1, _("Connect"))
        #self.loadButton = wx.Button(self.panel, -1, 'Load')
        self.printButton = wx.Button(self.panel, -1, _("Print"))
        self.pauseButton = wx.Button(self.panel, -1, _("Pause"))
        self.cancelButton = wx.Button(self.panel, -1, _("Cancel print"))
        self.machineLogButton = wx.Button(self.panel, -1, _("Error log"))
        self.progress = wx.Gauge(self.panel, -1)

        self.sizer.Add(self.connectButton, pos=(1, 1), flag=wx.EXPAND)
        #self.sizer.Add(self.loadButton, pos=(1,1), flag=wx.EXPAND)
        self.sizer.Add(self.printButton, pos=(2, 1), flag=wx.EXPAND)
        self.sizer.Add(self.pauseButton, pos=(3, 1), flag=wx.EXPAND)
        self.sizer.Add(self.cancelButton, pos=(4, 1), flag=wx.EXPAND)
        self.sizer.Add(self.machineLogButton, pos=(5, 1), flag=wx.EXPAND)
        self.sizer.Add(self.progress, pos=(7, 0), span=(1, 7), flag=wx.EXPAND)

        nb = wx.Notebook(self.panel)
        self.tabs = nb
        self.sizer.Add(nb, pos=(0, 2), span=(7, 4), flag=wx.EXPAND)

        self.temperaturePanel = wx.Panel(nb)
        sizer = wx.GridBagSizer(2, 2)
        self.temperaturePanel.SetSizer(sizer)

        self.temperatureSelect = wx.SpinCtrl(self.temperaturePanel,
                                             -1,
                                             '0',
                                             size=(21 * 3, 21),
                                             style=wx.SP_ARROW_KEYS)
        self.temperatureSelect.SetRange(0, 400)
        self.temperatureHeatUp = wx.Button(
            self.temperaturePanel, -1,
            str(int(profile.getProfileSettingFloat('print_temperature'))) +
            'C')
        self.bedTemperatureLabel = wx.StaticText(self.temperaturePanel, -1,
                                                 _("BedTemp:"))
        self.bedTemperatureSelect = wx.SpinCtrl(self.temperaturePanel,
                                                -1,
                                                '0',
                                                size=(21 * 3, 21),
                                                style=wx.SP_ARROW_KEYS)
        self.bedTemperatureSelect.SetRange(0, 400)
        self.bedTemperatureLabel.Show(False)
        self.bedTemperatureSelect.Show(False)

        self.temperatureGraph = temperatureGraph(self.temperaturePanel)

        sizer.Add(wx.StaticText(self.temperaturePanel, -1, _("Temp:")),
                  pos=(0, 0))
        sizer.Add(self.temperatureSelect, pos=(0, 1))
        sizer.Add(self.temperatureHeatUp, pos=(0, 2))
        sizer.Add(self.bedTemperatureLabel, pos=(1, 0))
        sizer.Add(self.bedTemperatureSelect, pos=(1, 1))
        sizer.Add(self.temperatureGraph,
                  pos=(2, 0),
                  span=(1, 3),
                  flag=wx.EXPAND)
        sizer.AddGrowableRow(2)
        sizer.AddGrowableCol(2)

        nb.AddPage(self.temperaturePanel, 'Temp')

        self.directControlPanel = wx.Panel(nb)

        sizer = wx.GridBagSizer(2, 2)
        self.directControlPanel.SetSizer(sizer)
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y100 F6000', 'G90'],
                                     'print-move-y100.png'),
                  pos=(0, 3))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y10 F6000', 'G90'],
                                     'print-move-y10.png'),
                  pos=(1, 3))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y1 F6000', 'G90'],
                                     'print-move-y1.png'),
                  pos=(2, 3))

        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y-1 F6000', 'G90'],
                                     'print-move-y-1.png'),
                  pos=(4, 3))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y-10 F6000', 'G90'],
                                     'print-move-y-10.png'),
                  pos=(5, 3))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Y-100 F6000', 'G90'],
                                     'print-move-y-100.png'),
                  pos=(6, 3))

        sizer.Add(PrintCommandButton(self, ['G91', 'G1 X-100 F6000', 'G90'],
                                     'print-move-x-100.png'),
                  pos=(3, 0))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 X-10 F6000', 'G90'],
                                     'print-move-x-10.png'),
                  pos=(3, 1))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 X-1 F6000', 'G90'],
                                     'print-move-x-1.png'),
                  pos=(3, 2))

        sizer.Add(PrintCommandButton(self, ['G28 X0 Y0'],
                                     'print-move-home.png'),
                  pos=(3, 3))

        sizer.Add(PrintCommandButton(self, ['G91', 'G1 X1 F6000', 'G90'],
                                     'print-move-x1.png'),
                  pos=(3, 4))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 X10 F6000', 'G90'],
                                     'print-move-x10.png'),
                  pos=(3, 5))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 X100 F6000', 'G90'],
                                     'print-move-x100.png'),
                  pos=(3, 6))

        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z10 F200', 'G90'],
                                     'print-move-z10.png'),
                  pos=(0, 8))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z1 F200', 'G90'],
                                     'print-move-z1.png'),
                  pos=(1, 8))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z0.1 F200', 'G90'],
                                     'print-move-z0.1.png'),
                  pos=(2, 8))

        sizer.Add(PrintCommandButton(self, ['G28 Z0'], 'print-move-home.png'),
                  pos=(3, 8))

        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z-0.1 F200', 'G90'],
                                     'print-move-z-0.1.png'),
                  pos=(4, 8))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z-1 F200', 'G90'],
                                     'print-move-z-1.png'),
                  pos=(5, 8))
        sizer.Add(PrintCommandButton(self, ['G91', 'G1 Z-10 F200', 'G90'],
                                     'print-move-z-10.png'),
                  pos=(6, 8))

        sizer.Add(PrintCommandButton(self, ['G92 E0', 'G1 E2 F120'],
                                     'extrude.png',
                                     size=(60, 20)),
                  pos=(1, 10),
                  span=(1, 3),
                  flag=wx.EXPAND)
        sizer.Add(PrintCommandButton(self, ['G92 E0', 'G1 E-2 F120'],
                                     'retract.png',
                                     size=(60, 20)),
                  pos=(2, 10),
                  span=(1, 3),
                  flag=wx.EXPAND)

        nb.AddPage(self.directControlPanel, _("Jog"))

        self.speedPanel = wx.Panel(nb)
        sizer = wx.GridBagSizer(2, 2)
        self.speedPanel.SetSizer(sizer)

        self.outerWallSpeedSelect = wx.SpinCtrl(self.speedPanel,
                                                -1,
                                                '100',
                                                size=(21 * 3, 21),
                                                style=wx.SP_ARROW_KEYS)
        self.outerWallSpeedSelect.SetRange(5, 1000)
        self.innerWallSpeedSelect = wx.SpinCtrl(self.speedPanel,
                                                -1,
                                                '100',
                                                size=(21 * 3, 21),
                                                style=wx.SP_ARROW_KEYS)
        self.innerWallSpeedSelect.SetRange(5, 1000)
        self.fillSpeedSelect = wx.SpinCtrl(self.speedPanel,
                                           -1,
                                           '100',
                                           size=(21 * 3, 21),
                                           style=wx.SP_ARROW_KEYS)
        self.fillSpeedSelect.SetRange(5, 1000)
        self.supportSpeedSelect = wx.SpinCtrl(self.speedPanel,
                                              -1,
                                              '100',
                                              size=(21 * 3, 21),
                                              style=wx.SP_ARROW_KEYS)
        self.supportSpeedSelect.SetRange(5, 1000)

        sizer.Add(wx.StaticText(self.speedPanel, -1, _("Outer wall:")),
                  pos=(0, 0))
        sizer.Add(self.outerWallSpeedSelect, pos=(0, 1))
        sizer.Add(wx.StaticText(self.speedPanel, -1, "%"), pos=(0, 2))
        sizer.Add(wx.StaticText(self.speedPanel, -1, _("Inner wall:")),
                  pos=(1, 0))
        sizer.Add(self.innerWallSpeedSelect, pos=(1, 1))
        sizer.Add(wx.StaticText(self.speedPanel, -1, "%"), pos=(1, 2))
        sizer.Add(wx.StaticText(self.speedPanel, -1, _("Fill:")), pos=(2, 0))
        sizer.Add(self.fillSpeedSelect, pos=(2, 1))
        sizer.Add(wx.StaticText(self.speedPanel, -1, "%"), pos=(2, 2))
        sizer.Add(wx.StaticText(self.speedPanel, -1, _("Support:")),
                  pos=(3, 0))
        sizer.Add(self.supportSpeedSelect, pos=(3, 1))
        sizer.Add(wx.StaticText(self.speedPanel, -1, "%"), pos=(3, 2))

        nb.AddPage(self.speedPanel, _("Speed"))

        self.termPanel = wx.Panel(nb)
        sizer = wx.GridBagSizer(2, 2)
        self.termPanel.SetSizer(sizer)

        f = wx.Font(8, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_NORMAL, False)
        self.termLog = wx.TextCtrl(self.termPanel,
                                   style=wx.TE_MULTILINE | wx.TE_DONTWRAP)
        self.termLog.SetFont(f)
        self.termLog.SetEditable(0)
        self.termInput = wx.TextCtrl(self.termPanel, style=wx.TE_PROCESS_ENTER)
        self.termInput.SetFont(f)

        sizer.Add(self.termLog, pos=(0, 0), flag=wx.EXPAND)
        sizer.Add(self.termInput, pos=(1, 0), flag=wx.EXPAND)
        sizer.AddGrowableCol(0)
        sizer.AddGrowableRow(0)

        nb.AddPage(self.termPanel, _("Term"))

        self.sizer.AddGrowableRow(6)
        self.sizer.AddGrowableCol(3)

        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.connectButton.Bind(wx.EVT_BUTTON, self.OnConnect)
        #self.loadButton.Bind(wx.EVT_BUTTON, self.OnLoad)
        self.printButton.Bind(wx.EVT_BUTTON, self.OnPrint)
        self.pauseButton.Bind(wx.EVT_BUTTON, self.OnPause)
        self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
        self.machineLogButton.Bind(wx.EVT_BUTTON, self.OnMachineLog)

        self.Bind(
            wx.EVT_BUTTON, lambda e:
            (self.temperatureSelect.SetValue(
                int(profile.getProfileSettingFloat('print_temperature'))),
             self.machineCom.sendCommand("M104 S%d" % (int(
                 profile.getProfileSettingFloat('print_temperature'))))),
            self.temperatureHeatUp)
        self.Bind(wx.EVT_SPINCTRL, self.OnTempChange, self.temperatureSelect)
        self.Bind(wx.EVT_SPINCTRL, self.OnBedTempChange,
                  self.bedTemperatureSelect)

        self.Bind(wx.EVT_SPINCTRL, self.OnSpeedChange,
                  self.outerWallSpeedSelect)
        self.Bind(wx.EVT_SPINCTRL, self.OnSpeedChange,
                  self.innerWallSpeedSelect)
        self.Bind(wx.EVT_SPINCTRL, self.OnSpeedChange, self.fillSpeedSelect)
        self.Bind(wx.EVT_SPINCTRL, self.OnSpeedChange, self.supportSpeedSelect)
        self.Bind(wx.EVT_TEXT_ENTER, self.OnTermEnterLine, self.termInput)
        self.termInput.Bind(wx.EVT_CHAR, self.OnTermKey)

        self.Layout()
        self.Fit()
        self.Centre()

        self.statsText.SetMinSize(self.statsText.GetSize())

        self.UpdateButtonStates()

        #self.UpdateProgress()
        self._thread = threading.Thread(target=self._stdinMonitor)
        self._thread.daemon = True
        self._thread.start()