示例#1
0
 def __do_layout(self):
     sizer_3 = wx.BoxSizer(wx.VERTICAL)
     sizer_11 = wx.BoxSizer(wx.VERTICAL)
     sizer_12 = wx.StaticBoxSizer(
         wx.StaticBox(self.tab_output, wx.ID_ANY, ""), wx.HORIZONTAL)
     sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
     layout_tab_scanner = wx.BoxSizer(wx.HORIZONTAL)
     sizer_13 = wx.StaticBoxSizer(
         wx.StaticBox(self.tab_scan, wx.ID_ANY, "Escanear"), wx.VERTICAL)
     grid_sizer_1 = wx.GridSizer(4, 2, 5, 5)
     layout_iface = wx.StaticBoxSizer(
         wx.StaticBox(self.tab_scan, wx.ID_ANY, "Selecciona Interface"),
         wx.VERTICAL)
     layout_iface.Add((20, 20), 0, wx.EXPAND, 0)
     layout_iface.Add(self.combo_iface, 0, wx.ALL | wx.EXPAND, 1)
     layout_iface.Add(self.txt_iface_modo, 0, wx.EXPAND, 0)
     layout_iface.Add(self.txt_iface_power, 0, wx.EXPAND, 0)
     layout_iface.Add((20, 20), 0, wx.EXPAND, 0)
     layout_iface.Add(self.btn_select_iface, 0, wx.EXPAND, 0)
     layout_iface.Add((20, 100), 0, wx.EXPAND, 0)
     layout_iface.Add(self.btn_airmon_toggle, 0, wx.EXPAND, 0)
     layout_iface.Add(self.btn_airmon_check, 0, wx.EXPAND, 0)
     layout_iface.Add(self.btn_powerup, 0, wx.EXPAND, 0)
     layout_tab_scanner.Add(layout_iface, 1,
                            wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 10)
     layout_tab_scanner.Add((20, 20), 0, wx.EXPAND, 0)
     label_canal = wx.StaticText(self.tab_scan,
                                 -1,
                                 "Lista de canales:",
                                 style=wx.ST_ELLIPSIZE_MIDDLE)
     label_canal.SetFont(
         wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                 wx.FONTWEIGHT_NORMAL, 0, "Noto Sans"))
     grid_sizer_1.Add(label_canal, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
     grid_sizer_1.Add(self.combo_canal, 0, wx.EXPAND, 0)
     label_1 = wx.StaticText(self.tab_scan, -1, "Tiempo de escaneo:")
     label_1.SetFont(
         wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                 wx.FONTWEIGHT_NORMAL, 0, "Noto Sans"))
     grid_sizer_1.Add(label_1, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
     grid_sizer_1.Add(self.spin_timeout, 0, wx.EXPAND, 0)
     label_2 = wx.StaticText(self.tab_scan, -1, "Tiempo de escaneo:")
     label_2.SetFont(
         wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                 wx.FONTWEIGHT_NORMAL, 0, "Noto Sans"))
     grid_sizer_1.Add(label_2, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
     grid_sizer_1.Add(self.txt_timeout, 0, wx.EXPAND, 0)
     grid_sizer_1.Add((20, 20), 0, wx.EXPAND, 0)
     grid_sizer_1.Add(self.btn_scan, 0, wx.EXPAND, 0)
     sizer_13.Add(grid_sizer_1, 1, wx.EXPAND, 0)
     sizer_13.Add((20, 20), 5, wx.EXPAND, 0)
     layout_tab_scanner.Add(sizer_13, 1, wx.EXPAND, 0)
     self.tab_scan.SetSizer(layout_tab_scanner)
     sizer_7.Add(self.lista_redes, 1, wx.EXPAND, 0)
     self.tab_redes.SetSizer(sizer_7)
     sizer_11.Add(self.txt_output, 11, wx.EXPAND, 0)
     sizer_12.Add((0, 0), 0, 0, 0)
     sizer_12.Add(self.btn_clear_output, 0, wx.EXPAND, 0)
     sizer_11.Add(sizer_12, 1, wx.EXPAND, 0)
     self.tab_output.SetSizer(sizer_11)
     self.tabs.AddPage(self.tab_scan, "Escanear")
     self.tabs.AddPage(self.tab_redes, "Redes")
     self.tabs.AddPage(self.tab_output, "Output")
     sizer_3.Add(self.tabs, 1, wx.ALL | wx.EXPAND, 1)
     self.SetSizer(sizer_3)
     self.Layout()
示例#2
0
    def __init__(self, parent, freq, callback):
        self.callback = callback
        self.cal = 0

        wx.Dialog.__init__(self,
                           parent=parent,
                           title="Auto Calibration",
                           style=wx.CAPTION)
        self.Bind(wx.EVT_CLOSE, self.on_close)

        title = wx.StaticText(self, label="Calibrate to a known stable signal")
        font = title.GetFont()
        font.SetPointSize(font.GetPointSize() + 2)
        title.SetFont(font)
        text = wx.StaticText(self, label="Frequency (MHz)")
        self.textFreq = masked.NumCtrl(self,
                                       value=freq,
                                       fractionWidth=3,
                                       min=F_MIN,
                                       max=F_MAX)

        self.buttonCal = wx.Button(self, label="Calibrate")
        self.buttonCal.Bind(wx.EVT_BUTTON, self.on_cal)
        self.textResult = wx.StaticText(self)

        self.buttonOk = wx.Button(self, wx.ID_OK, 'OK')
        self.buttonOk.Disable()
        self.buttonCancel = wx.Button(self, wx.ID_CANCEL, 'Cancel')

        self.buttonOk.Bind(wx.EVT_BUTTON, self.on_close)
        self.buttonCancel.Bind(wx.EVT_BUTTON, self.on_close)

        buttons = wx.StdDialogButtonSizer()
        buttons.AddButton(self.buttonOk)
        buttons.AddButton(self.buttonCancel)
        buttons.Realize()

        sizer = wx.GridBagSizer(10, 10)
        sizer.Add(title,
                  pos=(0, 0),
                  span=(1, 2),
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=10)
        sizer.Add(text, pos=(1, 0), flag=wx.ALL | wx.EXPAND, border=10)
        sizer.Add(self.textFreq, pos=(1, 1), flag=wx.ALL | wx.EXPAND, border=5)
        sizer.Add(self.buttonCal,
                  pos=(2, 0),
                  span=(1, 2),
                  flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND,
                  border=10)
        sizer.Add(self.textResult,
                  pos=(3, 0),
                  span=(1, 2),
                  flag=wx.ALL | wx.EXPAND,
                  border=10)
        sizer.Add(buttons,
                  pos=(4, 0),
                  span=(1, 2),
                  flag=wx.ALL | wx.EXPAND,
                  border=10)

        self.SetSizerAndFit(sizer)
示例#3
0
    def __init__(self, parent, devices, settings):
        self.settings = settings
        self.index = 0

        wx.Dialog.__init__(self, parent=parent, title="Preferences")

        title = wx.StaticText(self, label="Select a device")
        font = title.GetFont()
        font.SetPointSize(font.GetPointSize() + 2)
        title.SetFont(font)

        self.devices = devices
        self.gridDev = grid.Grid(self)
        self.gridDev.CreateGrid(len(self.devices), 6)
        self.gridDev.SetRowLabelSize(0)
        self.gridDev.SetColLabelValue(0, "Select")
        self.gridDev.SetColLabelValue(1, "Device")
        self.gridDev.SetColLabelValue(2, "Index")
        self.gridDev.SetColLabelValue(3, "Calibration\n(ppm)")
        self.gridDev.SetColLabelValue(4, "LO\n(MHz)")
        self.gridDev.SetColLabelValue(5, "Band Offset\n(kHz)")
        self.gridDev.SetColFormatFloat(3, -1, 3)
        self.gridDev.SetColFormatFloat(4, -1, 3)
        self.gridDev.SetColFormatFloat(5, -1, 0)

        attributes = grid.GridCellAttr()
        attributes.SetBackgroundColour(self.gridDev.GetLabelBackgroundColour())
        self.gridDev.SetColAttr(1, attributes)
        self.gridDev.SetColAttr(2, attributes)

        i = 0
        for device in self.devices:
            self.gridDev.SetReadOnly(i, 0, True)
            self.gridDev.SetReadOnly(i, 1, True)
            self.gridDev.SetReadOnly(i, 2, True)
            self.gridDev.SetCellRenderer(i, 0, CellRenderer())
            self.gridDev.SetCellEditor(i, 3, grid.GridCellFloatEditor(-1, 3))
            self.gridDev.SetCellEditor(i, 4, grid.GridCellFloatEditor(-1, 3))
            self.gridDev.SetCellValue(i, 1, device.name)
            self.gridDev.SetCellValue(i, 2, str(i))
            self.gridDev.SetCellValue(i, 3, str(device.calibration))
            self.gridDev.SetCellValue(i, 4, str(device.lo))
            self.gridDev.SetCellValue(i, 5, str(device.offset / 1e3))
            i += 1

        if settings.index > len(self.devices):
            settings.index = len(self.devices)
        self.select_row(settings.index)

        self.gridDev.AutoSize()

        self.Bind(grid.EVT_GRID_CELL_LEFT_CLICK, self.on_click)

        sizerButtons = wx.StdDialogButtonSizer()
        buttonOk = wx.Button(self, wx.ID_OK)
        buttonCancel = wx.Button(self, wx.ID_CANCEL)
        sizerButtons.AddButton(buttonOk)
        sizerButtons.AddButton(buttonCancel)
        sizerButtons.Realize()
        self.Bind(wx.EVT_BUTTON, self.on_ok, buttonOk)

        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(title, 0, wx.ALL | wx.EXPAND, 10)
        vbox.Add(self.gridDev, 0, wx.ALL | wx.EXPAND, 10)
        vbox.Add(sizerButtons, 0, wx.ALL | wx.EXPAND, 10)

        self.SetSizerAndFit(vbox)
示例#4
0
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Dialog.__init__(self, id=wxID_CONNECTDIALOG, name='ConnectDialog',
              parent=prnt, pos=wx.Point(727, 264), size=wx.Size(638, 567),
              style=wx.DEFAULT_DIALOG_STYLE, title='Connections')
        self._init_utils()
        self.SetClientSize(wx.Size(638, 567))
        self.Center(wx.BOTH)

        self.ConnectBtn = wx.Button(id=wxID_CONNECTDIALOGCONNECTBTN,
              label='Connect', name='ConnectBtn', parent=self, pos=wx.Point(239,
              182), size=wx.Size(85, 30), style=0)
        self.ConnectBtn.Bind(wx.EVT_BUTTON, self.OnConnectBtnButton,
              id=wxID_CONNECTDIALOGCONNECTBTN)

        self.ConLabel = wx.StaticText(id=wxID_CONNECTDIALOGCONLABEL,
              label='None', name='ConLabel', parent=self, pos=wx.Point(29, 21),
              size=wx.Size(31, 17), style=0)

        self.OkBtn = wx.Button(id=wxID_CONNECTDIALOGOKBTN, label=u'Ok',
              name=u'OkBtn', parent=self, pos=wx.Point(488, 496),
              size=wx.Size(85, 30), style=0)
        self.OkBtn.Bind(wx.EVT_BUTTON, self.OnOkBtnButton,
              id=wxID_CONNECTDIALOGOKBTN)

        self.srcBox = wx.TreeCtrl(id=wxID_CONNECTDIALOGSRCBOX, name=u'srcBox',
              parent=self, pos=wx.Point(24, 48), size=wx.Size(199, 296),
              style=wx.SIMPLE_BORDER | wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT)
        self.srcBox.SetImageList(self.imageList1)
        self.srcBox.SetBestFittingSize(wx.Size(199, 296))
        self.srcBox.Bind(wx.EVT_LEFT_UP, self.OnSrcBoxLeftUp)

        self.dstBox = wx.TreeCtrl(id=wxID_CONNECTDIALOGDSTBOX, name=u'dstBox',
              parent=self, pos=wx.Point(340, 48), size=wx.Size(278, 296),
              style=wx.SIMPLE_BORDER | wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT)
        self.dstBox.SetImageList(self.imageList1)
        self.dstBox.SetBestFittingSize(wx.Size(278, 296))
        self.dstBox.Bind(wx.EVT_LEFT_UP, self.OnDstBoxLeftUp)

        self.connectBox = wx.ListBox(choices=[],
              id=wxID_CONNECTDIALOGCONNECTBOX, name=u'connectBox', parent=self,
              pos=wx.Point(52, 429), size=wx.Size(401, 118), style=0)
        self.connectBox.SetBestFittingSize(wx.Size(401, 118))

        self.staticText1 = wx.StaticText(id=wxID_CONNECTDIALOGSTATICTEXT1,
              label=u'Connections', name='staticText1', parent=self,
              pos=wx.Point(214, 405), size=wx.Size(105, 17), style=0)

        self.staticText2 = wx.StaticText(id=wxID_CONNECTDIALOGSTATICTEXT2,
              label=u'Available ports to connect to:', name='staticText2',
              parent=self, pos=wx.Point(394, 21), size=wx.Size(235, 17),
              style=0)

        self.intLabelSrc = wx.StaticText(id=wxID_CONNECTDIALOGINTLABELSRC,
              label=u'intLabelSrc', name=u'intLabelSrc', parent=self,
              pos=wx.Point(120, 352), size=wx.Size(65, 17), style=0)

        self.intLabelDst = wx.StaticText(id=wxID_CONNECTDIALOGINTLABELDST,
              label=u'intLabelDst', name=u'intLabelDst', parent=self,
              pos=wx.Point(466, 352), size=wx.Size(66, 17), style=0)

        self.staticText3 = wx.StaticText(id=wxID_CONNECTDIALOGSTATICTEXT3,
              label=u'Interface:', name='staticText3', parent=self,
              pos=wx.Point(30, 352), size=wx.Size(67, 17), style=0)
        self.staticText3.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Sans'))

        self.staticText4 = wx.StaticText(id=wxID_CONNECTDIALOGSTATICTEXT4,
              label=u'Interface:', name='staticText4', parent=self,
              pos=wx.Point(386, 352), size=wx.Size(67, 17), style=0)
        self.staticText4.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Sans'))

        self.staticBox1 = wx.StaticBox(id=wxID_CONNECTDIALOGSTATICBOX1,
              label=u'Legend', name='staticBox1', parent=self, pos=wx.Point(233,
              264), size=wx.Size(96, 68), style=0)
        self.staticBox1.SetBestFittingSize(wx.Size(96, 68))

        root = __file__
        if os.path.islink (root):
              root = os.path.realpath (root)
        root = os.path.dirname (os.path.abspath (root))
        self.staticBitmap1 = wx.StaticBitmap(bitmap=wx.Bitmap( root+ '/images/uses.bmp',
              wx.BITMAP_TYPE_BMP), id=wxID_CONNECTDIALOGSTATICBITMAP1,
              name='staticBitmap1', parent=self, pos=wx.Point(245, 286),
              size=wx.Size(16, 16), style=0)

        self.staticBitmap2 = wx.StaticBitmap(bitmap=wx.Bitmap( root + '/images/provides.bmp',
              wx.BITMAP_TYPE_BMP), id=wxID_CONNECTDIALOGSTATICBITMAP2,
              name='staticBitmap2', parent=self, pos=wx.Point(245, 306),
              size=wx.Size(16, 16), style=0)

        self.staticText5 = wx.StaticText(id=wxID_CONNECTDIALOGSTATICTEXT5,
              label=u'Uses', name='staticText5', parent=self, pos=wx.Point(269,
              284), size=wx.Size(55, 17), style=0)

        self.staticText6 = wx.StaticText(id=wxID_CONNECTDIALOGSTATICTEXT6,
              label=u'Provides', name='staticText6', parent=self,
              pos=wx.Point(269, 304), size=wx.Size(60, 17), style=0)
示例#5
0
    def __init__(self, updater, open_properties):
        self.updater = updater
        self.open_properties = open_properties

        self.dialog = wx.Dialog(parent=wx.GetApp().root, title="Open database")

        outsizer = wx.BoxSizer(wx.VERTICAL)
        self.dialog.SetSizer(outsizer)

        vsizer = wx.BoxSizer(wx.VERTICAL)

        # Add vsizer right here because then I use Fit in order to make
        # vsizer.GetSize().GetWidth() work
        outsizer.Add(vsizer, flag=wx.EXPAND | wx.ALL, border=12)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        icon = wx.StaticBitmap(
            self.dialog,
            bitmap=wx.GetApp().artprovider.get_dialog_icon('@question'))
        hsizer.Add(icon, flag=wx.ALIGN_TOP | wx.RIGHT, border=12)

        hvsizer = wx.BoxSizer(wx.VERTICAL)

        # Core will never be in the dependencies here
        label = wx.StaticText(self.dialog,
                              label="{} is missing support for "
                              "the following installed extensions:".format(
                                  self.updater.get_filename()))
        label.Wrap(320)
        hvsizer.Add(label, flag=wx.BOTTOM, border=4)

        self.deplist = []
        deptext = []

        for addon in self.updater.get_addible_dependencies():
            self.deplist.append(addon)
            deptext.append(u"\u2022 {}".format(addon))

        label = wx.StaticText(self.dialog, label="\n".join(deptext))
        label.Wrap(320)
        hvsizer.Add(label)

        hsizer.Add(hvsizer, flag=wx.ALIGN_TOP)

        vsizer.Add(hsizer, flag=wx.ALIGN_CENTER | wx.BOTTOM, border=12)

        add = wx.Button(self.dialog, label="Add &support and open database")
        vsizer.Add(add, flag=wx.EXPAND | wx.BOTTOM, border=4)

        label = wx.StaticText(
            self.dialog,
            label="Warning: enabling "
            "dependencies will clear all the history of the database.")
        # Fit in order to make vsizer.GetSize().GetWidth() work
        self.dialog.Fit()
        label.Wrap(vsizer.GetSize().GetWidth())
        vsizer.Add(label, flag=wx.BOTTOM, border=4)

        hsizer2 = wx.BoxSizer(wx.HORIZONTAL)

        label = wx.StaticText(self.dialog, label="A backup will be saved in:")
        hsizer2.Add(label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=4)

        defpath = time_.strftime('{}_%Y%m%d%H%M%S{}'.format(
            *os.path.splitext(self.updater.get_filename())))
        self.backup = wx.FilePickerCtrl(
            self.dialog,
            message="Save backup",
            wildcard="|".join(('Outspline database (*.{})|*.{}'.format(
                coreaux_api.get_standard_extension(),
                coreaux_api.get_standard_extension()), "All files (*)|*")),
            style=wx.FLP_SAVE | wx.FLP_OVERWRITE_PROMPT | wx.FLP_USE_TEXTCTRL)
        # Instantiating FilePickerCtrl with 'path' doesn't seem to work well
        self.backup.SetPath(defpath)
        hsizer2.Add(self.backup, 1, flag=wx.ALIGN_CENTER_VERTICAL)

        vsizer.Add(hsizer2, flag=wx.EXPAND | wx.BOTTOM, border=12)

        vsizer.Add(wx.StaticLine(self.dialog),
                   flag=wx.EXPAND | wx.BOTTOM,
                   border=12)

        skip = wx.Button(self.dialog, label="&Open database as it is")
        vsizer.Add(skip, flag=wx.EXPAND | wx.BOTTOM, border=4)

        label = wx.StaticText(self.dialog,
                              label="This dialog will appear "
                              "every time the database is opened, unless "
                              "disabled in the database properties.")
        # Fit in order to make vsizer.GetSize().GetWidth() work
        self.dialog.Fit()
        label.Wrap(vsizer.GetSize().GetWidth())
        vsizer.Add(label, flag=wx.EXPAND | wx.BOTTOM, border=12)

        vsizer.Add(wx.StaticLine(self.dialog),
                   flag=wx.EXPAND | wx.BOTTOM,
                   border=12)

        abort = wx.Button(self.dialog, label="&Abort opening database")
        vsizer.Add(abort, flag=wx.EXPAND)

        self.dialog.Bind(wx.EVT_BUTTON, self._add, add)
        self.dialog.Bind(wx.EVT_BUTTON, self._skip, skip)
        self.dialog.Bind(wx.EVT_BUTTON, self._abort, abort)
        self.dialog.Bind(wx.EVT_CLOSE, self._handle_close)

        self.dialog.Fit()
        self.dialog.ShowModal()
示例#6
0
文件: gui.py 项目: wkpalan/aigo
    def __init__(self, *args, **kwds):
        # begin wxGlade: AIGOnotebook.__init__
        kwds["style"] = 0
        wx.Notebook.__init__(self, *args, **kwds)
        self.notebook_Plot = wx.Panel(self, -1)
        self.notebook_Compare = wx.Panel(self, -1)
        self.notebook_Compare_Aspect = wx.Notebook(self.notebook_Compare, -1, style=0)
        self.notebook_Compare_Aspect_pane_4 = wx.Panel(self.notebook_Compare_Aspect, -1)
        self.notebook_Compare_Aspect_pane_3 = wx.Panel(self.notebook_Compare_Aspect, -1)
        self.notebook_Compare_Aspect_pane_2 = wx.Panel(self.notebook_Compare_Aspect, -1)
        self.notebook_1_pane_1 = wx.Panel(self.notebook_Compare_Aspect, -1)
        self.notebook_Analysis = wx.Panel(self, -1)
        self.notebook_Statistics = wx.Notebook(self.notebook_Analysis, -1, style=wx.NB_LEFT)
        self.notebook_cellular_component = wx.Panel(self.notebook_Statistics, -1)
        self.notebook_molecular_function = wx.Panel(self.notebook_Statistics, -1)
        self.notebook_biological_process = wx.Panel(self.notebook_Statistics, -1)
        self.notebook_All_aspects_of_GO = wx.Panel(self.notebook_Statistics, -1)
        self.notebook_Data = wx.Panel(self, -1)
        self.sizer_GP_staticbox = wx.StaticBox(self.notebook_Data, -1, "Gene Products")
        self.sizer_FA_staticbox = wx.StaticBox(self.notebook_Data, -1, "Functional Annotations")
        self.sizer_16_staticbox = wx.StaticBox(self.notebook_Analysis, -1, "Statistics")
        self.sizer_27_copy_1_staticbox = wx.StaticBox(self.notebook_Compare, -1, "Select one or two Functional Annotations")
        self.sizer_31_staticbox = wx.StaticBox(self.notebook_Compare, -1, "Update information")
        self.sizer_27_copy_staticbox = wx.StaticBox(self.notebook_1_pane_1, -1, "")
        self.sizer_27_copy_copy_staticbox = wx.StaticBox(self.notebook_Compare_Aspect_pane_2, -1, "")
        self.sizer_27_copy_copy_1_staticbox = wx.StaticBox(self.notebook_Compare_Aspect_pane_3, -1, "")
        self.sizer_27_copy_copy_2_staticbox = wx.StaticBox(self.notebook_Compare_Aspect_pane_4, -1, "")
        self.sizer_23_staticbox = wx.StaticBox(self.notebook_Plot, -1, "")
        self.sizer_GO_staticbox = wx.StaticBox(self.notebook_Data, -1, "Gene Ontology")
        self.label_GO = wx.TextCtrl(self.notebook_Data, -1, "Choose the Gene Ontology", style=wx.TE_READONLY|wx.NO_BORDER)
        self.box_GO = wx.TextCtrl(self.notebook_Data, -1, "", style=wx.HSCROLL)
        self.button_GOChoose = wx.Button(self.notebook_Data, -1, "&Browse", style=wx.BU_EXACTFIT)
        self.button_GOLoad = wx.Button(self.notebook_Data, wx.ID_OPEN, "", style=wx.BU_EXACTFIT)
        self.radio_btn_GO = wx.RadioBox(self.notebook_Data, -1, "OBO format", choices=["XML", "Text"], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.checkbox_GO = wx.CheckBox(self.notebook_Data, -1, "Read previously serialised version")
        self.label_RefSet = wx.TextCtrl(self.notebook_Data, -1, "Choose the set of gene products", style=wx.TE_READONLY|wx.NO_BORDER)
        self.box_RefSet = wx.TextCtrl(self.notebook_Data, -1, "", style=wx.HSCROLL)
        self.button_RefSetChoose = wx.Button(self.notebook_Data, -1, "B&rowse", style=wx.BU_EXACTFIT)
        self.button_RefSetLoad = wx.Button(self.notebook_Data, wx.ID_OPEN, "", style=wx.BU_EXACTFIT)
        self.radio_btn_RefSet = wx.RadioBox(self.notebook_Data, -1, "File format", choices=["Fasta", "Text"], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.button_AddFA = wx.Button(self.notebook_Data, wx.ID_ADD, "")
        self.button_RemoveFA = wx.Button(self.notebook_Data, wx.ID_REMOVE, "")
        self.list_FA = wx.ListCtrl(self.notebook_Data, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
        self.button_LoadFA = wx.Button(self.notebook_Data, -1, "&Load")
        self.checkbox_unconnected = wx.CheckBox(self.notebook_Analysis, -1, "Obsolescence")
        self.label_unconnected = wx.StaticText(self.notebook_Analysis, -1, "Proportion of obsoletete annotations in annotation sets for which not alternative have been provided", style=wx.ALIGN_RIGHT)
        self.bitmap_unconnected = wx.StaticBitmap(self.notebook_Analysis, -1, wx.NullBitmap)
        self.checkbox_removeUnconnected = wx.CheckBox(self.notebook_Analysis, -1, "Remove Obsolete")
        self.label_removeUnconnected = wx.StaticText(self.notebook_Analysis, -1, "Remove obsolete annotations in all annotations sets", style=wx.ALIGN_RIGHT)
        self.bitmap_removeUnconnected = wx.StaticBitmap(self.notebook_Analysis, -1, wx.NullBitmap)
        self.checkbox_coverage = wx.CheckBox(self.notebook_Analysis, -1, "Coverage")
        self.label_coverage = wx.StaticText(self.notebook_Analysis, -1, "Proportion of gene products being annotated to at least on term", style=wx.ALIGN_RIGHT)
        self.bitmap_coverage = wx.StaticBitmap(self.notebook_Analysis, -1, wx.NullBitmap)
        self.checkbox_richness = wx.CheckBox(self.notebook_Analysis, -1, "Richness")
        self.label_richness = wx.StaticText(self.notebook_Analysis, -1, "Proportion of the terms in GO being assigned to at least one term", style=wx.ALIGN_RIGHT)
        self.bitmap_richness = wx.StaticBitmap(self.notebook_Analysis, -1, wx.NullBitmap)
        self.checkbox_numberAnnot = wx.CheckBox(self.notebook_Analysis, -1, "Number of Annotations")
        self.label_numberAnnot = wx.StaticText(self.notebook_Analysis, -1, "Number of annotation of an annotated gene product", style=wx.ALIGN_RIGHT)
        self.bitmap_numberAnnot = wx.StaticBitmap(self.notebook_Analysis, -1, wx.NullBitmap)
        self.checkbox_coherence = wx.CheckBox(self.notebook_Analysis, -1, "Coherence")
        self.label_coherence = wx.StaticText(self.notebook_Analysis, -1, "Semantic Distance of an annotation set", style=wx.ALIGN_RIGHT)
        self.bitmap_coherence = wx.StaticBitmap(self.notebook_Analysis, -1, wx.NullBitmap)
        self.checkbox_compactness = wx.CheckBox(self.notebook_Analysis, -1, "Compactness")
        self.label_compactness = wx.StaticText(self.notebook_Analysis, -1, "Semantic Distance between all annotation sets", style=wx.ALIGN_RIGHT)
        self.bitmap_compactness = wx.StaticBitmap(self.notebook_Analysis, -1, wx.NullBitmap)
        self.checkbox_specificity = wx.CheckBox(self.notebook_Analysis, -1, "Specificity")
        self.label_specificity = wx.StaticText(self.notebook_Analysis, -1, "Average number of ancestors over all the terms of an annotation set", style=wx.ALIGN_RIGHT)
        self.bitmap_specificity = wx.StaticBitmap(self.notebook_Analysis, -1, wx.NullBitmap)
        self.checkbox_informationContent = wx.CheckBox(self.notebook_Analysis, -1, "Information Content")
        self.label_informationContent = wx.StaticText(self.notebook_Analysis, -1, "Average Information Content over all the terms of an annotation set", style=wx.ALIGN_RIGHT)
        self.bitmap_informationContent = wx.StaticBitmap(self.notebook_Analysis, -1, wx.NullBitmap)
        self.checkbox_redundancy = wx.CheckBox(self.notebook_Analysis, -1, "Redundancy")
        self.label_redundancy = wx.StaticText(self.notebook_Analysis, -1, "Proportion of terms being ancestor one other term in an annotation set", style=wx.ALIGN_RIGHT)
        self.bitmap_redundancy = wx.StaticBitmap(self.notebook_Analysis, -1, wx.NullBitmap)
        self.button_Apply = wx.Button(self.notebook_Analysis, wx.ID_APPLY, "")
        self.grid_All_aspects_of_GO = StatisticsGrid(self.notebook_All_aspects_of_GO, -1, size=(1, 1))
        self.grid_biological_process = StatisticsGrid(self.notebook_biological_process, -1, size=(1, 1))
        self.grid_molecular_function = StatisticsGrid(self.notebook_molecular_function, -1, size=(1, 1))
        self.grid_cellular_component = StatisticsGrid(self.notebook_cellular_component, -1, size=(1, 1))
        self.button_Export = wx.Button(self.notebook_Analysis, wx.ID_FORWARD, "")
        self.combo_box_Compare_FA1 = wx.ComboBox(self.notebook_Compare, -1, choices=[], style=wx.CB_DROPDOWN|wx.CB_READONLY)
        self.combo_box_Compare_FA2 = wx.ComboBox(self.notebook_Compare, -1, choices=[], style=wx.CB_DROPDOWN|wx.CB_READONLY)
        self.button_Update_Venn = wx.Button(self.notebook_Compare, wx.ID_REFRESH, "")
        self.button_Update_FuncSim = wx.Button(self.notebook_Compare, wx.ID_REFRESH, "")
        self.bitmap_Venn_All_aspects_of_GO = wx.StaticBitmap(self.notebook_1_pane_1, -1, wx.NullBitmap)
        self.bitmap_All_aspects_of_GO = wx.StaticBitmap(self.notebook_1_pane_1, -1, wx.NullBitmap)
        self.bitmap_FuncSim_All_aspects_of_GO = wx.StaticBitmap(self.notebook_1_pane_1, -1, wx.NullBitmap)
        self.list_ctrl_Compare_All_aspects_of_GO = FastObjectListView(self.notebook_1_pane_1, -1, style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_SORT_ASCENDING|wx.LC_HRULES|wx.SUNKEN_BORDER)
        self.button_Compare_All_aspects_of_GO = wx.Button(self.notebook_1_pane_1, wx.ID_ZOOM_IN, "")
        self.bitmap_Venn_biological_process = wx.StaticBitmap(self.notebook_Compare_Aspect_pane_2, -1, wx.NullBitmap)
        self.bitmap_biological_process = wx.StaticBitmap(self.notebook_Compare_Aspect_pane_2, -1, wx.NullBitmap)
        self.bitmap_FuncSim_biological_process = wx.StaticBitmap(self.notebook_Compare_Aspect_pane_2, -1, wx.NullBitmap)
        self.list_ctrl_Compare_biological_process = FastObjectListView(self.notebook_Compare_Aspect_pane_2, -1, style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_SORT_ASCENDING|wx.LC_HRULES|wx.SUNKEN_BORDER)
        self.button_Compare_biological_process = wx.Button(self.notebook_Compare_Aspect_pane_2, wx.ID_ZOOM_IN, "")
        self.bitmap_Venn_molecular_function = wx.StaticBitmap(self.notebook_Compare_Aspect_pane_3, -1, wx.NullBitmap)
        self.bitmap_molecular_function = wx.StaticBitmap(self.notebook_Compare_Aspect_pane_3, -1, wx.NullBitmap)
        self.bitmap_FuncSim_molecular_function = wx.StaticBitmap(self.notebook_Compare_Aspect_pane_3, -1, wx.NullBitmap)
        self.list_ctrl_Compare_molecular_function = FastObjectListView(self.notebook_Compare_Aspect_pane_3, -1, style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_SORT_ASCENDING|wx.LC_HRULES|wx.SUNKEN_BORDER)
        self.button_Compare_molecular_function = wx.Button(self.notebook_Compare_Aspect_pane_3, wx.ID_ZOOM_IN, "")
        self.bitmap_Venn_cellular_component = wx.StaticBitmap(self.notebook_Compare_Aspect_pane_4, -1, wx.NullBitmap)
        self.bitmap_cellular_component = wx.StaticBitmap(self.notebook_Compare_Aspect_pane_4, -1, wx.NullBitmap)
        self.bitmap_FuncSim_cellular_component = wx.StaticBitmap(self.notebook_Compare_Aspect_pane_4, -1, wx.NullBitmap)
        self.list_ctrl_Compare_cellular_component = FastObjectListView(self.notebook_Compare_Aspect_pane_4, -1, style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_SORT_ASCENDING|wx.LC_HRULES|wx.SUNKEN_BORDER)
        self.button_Compare_cellular_component = wx.Button(self.notebook_Compare_Aspect_pane_4, wx.ID_ZOOM_IN, "")
        self.label_PlotStatistics = wx.StaticText(self.notebook_Plot, -1, "Select a statistics")
        self.combo_PlotStat = wx.ComboBox(self.notebook_Plot, -1, choices=[], style=wx.CB_DROPDOWN)
        self.label_2 = wx.StaticText(self.notebook_Plot, -1, "Plot type")
        self.combo_PlotType = wx.ComboBox(self.notebook_Plot, -1, choices=[], style=wx.CB_DROPDOWN)
        self.label_PlotStatistics_copy = wx.StaticText(self.notebook_Plot, -1, "Select Functional Annotations")
        self.list_PlotFA = wx.ListBox(self.notebook_Plot, -1, choices=[], style=wx.LB_MULTIPLE|wx.LB_HSCROLL|wx.LB_NEEDED_SB)
        self.bitmap_Plot = wx.StaticBitmap(self.notebook_Plot, -1, wx.NullBitmap, style=wx.RAISED_BORDER)

        self.__set_properties()
        self.__do_layout()
示例#7
0
文件: settings.py 项目: jackm/nuxhash
    def __init__(self, parent, commit_callback=lambda settings: None,
                 *args, **kwargs):
        wx.Panel.__init__(self, parent, *args, **kwargs)
        self._settings = self.new_settings = None
        self._commit_callback = commit_callback

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

        # Add basic setting controls.
        basic_form = wx.Window(self)
        sizer.Add(basic_form, wx.SizerFlags().Border(wx.ALL, main.PADDING_PX)
                                             .Expand())
        basic_sizer = wx.FlexGridSizer(3, 2, main.PADDING_PX, main.PADDING_PX)
        basic_sizer.AddGrowableCol(1)
        basic_form.SetSizer(basic_sizer)

        basic_sizer.Add(wx.StaticText(basic_form, label='Wallet address'),
                        wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))
        self._wallet = wx.TextCtrl(basic_form, size=(-1, -1))
        self.Bind(wx.EVT_TEXT, self.OnWalletChange, self._wallet)
        basic_sizer.Add(self._wallet,
                        wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL).Expand())

        basic_sizer.Add(wx.StaticText(basic_form, label='Worker name'),
                        wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))
        self._worker = wx.TextCtrl(basic_form, size=(200, -1))
        self.Bind(wx.EVT_TEXT, self.OnWorkerChange, self._worker)
        basic_sizer.Add(self._worker,
                        wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))

        basic_sizer.Add(wx.StaticText(basic_form, label='Region'),
                        wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))
        self._region = ChoiceByValue(
            basic_form, choices=REGIONS,
            fallback_choice=settings.DEFAULT_SETTINGS['nicehash']['region'])
        self.Bind(wx.EVT_CHOICE, self.OnRegionChange, self._region)
        basic_sizer.Add(self._region, wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))

        # Add divider.
        sizer.Add(wx.StaticLine(self), wx.SizerFlags().Expand())

        # Add advanced setting controls.
        advanced_form = wx.Window(self)
        sizer.Add(advanced_form, wx.SizerFlags().Border(wx.ALL, main.PADDING_PX)
                                                .Expand())
        advanced_sizer = wx.FlexGridSizer(3, 2, main.PADDING_PX, main.PADDING_PX)
        advanced_sizer.AddGrowableCol(1)
        advanced_form.SetSizer(advanced_sizer)

        advanced_sizer.Add(
            wx.StaticText(advanced_form, label='Update interval (secs)'),
            wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))
        self._interval = wx.SpinCtrl(advanced_form, size=(125, -1),
                                     min=10, max=300, initial=60)
        self.Bind(wx.EVT_SPINCTRL, self.OnIntervalChange, self._interval)
        advanced_sizer.Add(self._interval,
                           wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))

        advanced_sizer.Add(
            wx.StaticText(advanced_form, label='Profitability switch threshold (%)'),
            wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))
        self._threshold = wx.SpinCtrl(advanced_form, size=(125, -1),
                                      min=1, max=50, initial=10)
        self.Bind(wx.EVT_SPINCTRL, self.OnThresholdChange, self._threshold)
        advanced_sizer.Add(self._threshold,
                           wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))

        advanced_sizer.Add(
            wx.StaticText(advanced_form, label='Display units'),
            wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))
        self._units = ChoiceByValue(
            advanced_form, choices=UNITS,
            fallback_choice=settings.DEFAULT_SETTINGS['gui']['units'])
        self.Bind(wx.EVT_CHOICE, self.OnUnitsChange, self._units)
        advanced_sizer.Add(self._units,
                           wx.SizerFlags().Align(wx.ALIGN_CENTER_VERTICAL))

        # Add spacer.
        sizer.AddStretchSpacer()

        # Add revert/save controls.
        save_form = wx.Window(self)
        sizer.Add(save_form, wx.SizerFlags().Border(wx.ALL, main.PADDING_PX)
                                            .Right())
        save_sizer = wx.BoxSizer(orient=wx.HORIZONTAL)
        save_form.SetSizer(save_sizer)

        self._revert = wx.Button(save_form, label='Revert')
        self.Bind(wx.EVT_BUTTON, self.OnRevert, self._revert)
        save_sizer.Add(self._revert)

        save_sizer.AddSpacer(main.PADDING_PX)

        self._save = wx.Button(save_form, label='Save')
        self.Bind(wx.EVT_BUTTON, self.OnSave, self._save)
        save_sizer.Add(self._save)
示例#8
0
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)
        self.SetDoubleBuffered(
            True)  # Remove odd effects at main switch to this pane after login

        # Parental inheritance
        self.parent = parent

        # Set user for application
        self.user = os.getlogin()

        # Load tags and the mapping of tag to id
        self.ls_tags = []
        self.tag_to_id = {}
        self.load_tags()

        # Define and load mappings between id and discipline
        self.id_to_discipline = {}
        self.discipline_to_id = {}
        self.load_disciplines()

        # Define and load mappings between id and category
        self.id_to_category = {}
        self.category_to_id = {}
        self.load_categories()

        # Define and load mappings between id and level3
        self.id_to_level3 = {}
        self.level3_to_id = {}
        self.load_level3()

        # Search bar and bind
        self.wgt_searchbar = wx.TextCtrl(self,
                                         size=(PaneMain.bar_size * 10,
                                               PaneMain.bar_size),
                                         style=wx.TE_PROCESS_ENTER)
        self.wgt_searchbar.Bind(wx.EVT_TEXT_ENTER, self.evt_search)

        # Search bar button and bind
        btn_search = wx.BitmapButton(self,
                                     bitmap=wx.Bitmap(
                                         fn_path.concat_gui('search.png')),
                                     size=(PaneMain.bar_size, ) * 2)
        btn_search.Bind(wx.EVT_BUTTON, self.evt_search)
        btn_search.Bind(wx.EVT_SET_FOCUS, self.evt_button_no_focus)

        # Notebook widget
        self.wgt_notebook = tab.Notebook(self)

        # Restrictions sizer
        self.wgt_restrictions = widget.Restrictions(self)
        self.wgt_restrictions.Bind(wx.EVT_LEFT_DOWN,
                                   self.wgt_restrictions.evt_click_header)
        self.wgt_restrictions.SetMinSize((500, -1))

        # Top bar sizer
        szr_top_bar = wx.BoxSizer(wx.HORIZONTAL)
        szr_top_bar.AddSpacer(3)
        szr_top_bar.Add(self.wgt_searchbar)
        szr_top_bar.AddSpacer(2)
        szr_top_bar.Add(btn_search)
        szr_top_bar.Add(wx.StaticText(self), proportion=1)
        szr_top_bar.Add(self.wgt_restrictions, flag=wx.RIGHT)
        szr_top_bar.AddSpacer(2)

        # Main Sizer
        self.szr_main = wx.BoxSizer(wx.VERTICAL)
        self.szr_main.Add(szr_top_bar, flag=wx.EXPAND)
        self.szr_main.AddSpacer(1)
        self.szr_main.Add(wx.StaticLine(self, style=wx.LI_HORIZONTAL),
                          flag=wx.EXPAND)
        self.szr_main.Add(self.wgt_notebook, proportion=1, flag=wx.EXPAND)

        # Set sizer and refresh layout
        self.SetSizer(self.szr_main)
        self.Layout()
示例#9
0
    def setup_panel(self):
        """
        Make/remake the main panel.
        :return: None
        """
        # TODO: Inherit this from mainwindow somehow so controls are the same.
        for child in self.pnl.GetChildren():
            child.Destroy()
        for child in self.pnl2.GetChildren():
            child.Destroy()
        vbox = wx.BoxSizer(wx.VERTICAL)
        sb = wx.StaticBox(self.pnl, label='Ion Mobility Parameters Tool')
        sbs = wx.StaticBoxSizer(sb, orient=wx.VERTICAL)

        self.plot = plot2d.Plot2d(self.pnl)
        self.plot.contourplot(self.data3,
                              self.config,
                              xlab="m/z (Th)",
                              ylab="Arrival Time (ms)",
                              title="IM-MS Data")
        sbs.Add(self.plot, 1, wx.EXPAND)

        ctlsizer = wx.BoxSizer(wx.HORIZONTAL)
        sb2 = wx.StaticBox(self.pnl, label='Instrumental Parameters')
        sbs2 = wx.StaticBoxSizer(sb2, orient=wx.VERTICAL)
        gbox1c = wx.GridBagSizer(wx.VERTICAL)
        size1 = (75, -1)
        self.ctltwave = wx.RadioBox(self.pnl,
                                    label="",
                                    choices=["Linear Cell", "Travelling Wave"])
        self.Bind(wx.EVT_RADIOBOX, self.on_flip_twave, self.ctltwave)
        gbox1c.Add(self.ctltwave, (0, 0), span=(1, 5))

        self.twave = self.config.twaveflag > 0
        if not self.twave:
            self.ctltwave.SetSelection(0)
            # Linear Mode controls
            self.ctlvolt = wx.TextCtrl(self.pnl, value="", size=size1)
            gbox1c.Add(self.ctlvolt, (1, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl, label="Voltage (V): "), (1, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

            self.ctlpressure = wx.TextCtrl(self.pnl, value='', size=size1)
            gbox1c.Add(self.ctlpressure, (2, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl, label="Pressure (Torr): "),
                       (2, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

            self.ctltemp = wx.TextCtrl(self.pnl, value='', size=size1)
            gbox1c.Add(self.ctltemp, (3, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl,
                                     label="Temperature (\u00B0C): "), (3, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

            self.ctlgasmass = wx.TextCtrl(self.pnl, value='', size=size1)
            gbox1c.Add(self.ctlgasmass, (4, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl, label="Gas Mass (Da): "),
                       (4, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

            self.ctlto = wx.TextCtrl(self.pnl, value='', size=size1)
            gbox1c.Add(self.ctlto, (5, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl,
                                     label="Dead Time (t\u2080 in ms): "),
                       (5, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

            self.ctldriftlength = wx.TextCtrl(self.pnl, value='', size=size1)
            gbox1c.Add(self.ctldriftlength, (6, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl, label="Drift Cell Length (m)"),
                       (6, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

        else:
            self.ctltwave.SetSelection(1)
            # T-Wave Controls
            self.ctltcal1 = wx.TextCtrl(self.pnl, value="", size=size1)
            gbox1c.Add(self.ctltcal1, (1, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl,
                                     label="Calibration Parameter 1: "),
                       (1, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

            self.ctltcal2 = wx.TextCtrl(self.pnl, value='', size=size1)
            gbox1c.Add(self.ctltcal2, (2, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl,
                                     label="Calibration Parameter 2: "),
                       (2, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

            self.ctledc = wx.TextCtrl(self.pnl, value='', size=size1)
            gbox1c.Add(self.ctledc, (3, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl, label="EDC Parameter: "),
                       (3, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

            self.ctlgasmass = wx.TextCtrl(self.pnl, value='', size=size1)
            gbox1c.Add(self.ctlgasmass, (4, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl, label="Gas Mass (Da): "),
                       (4, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

            self.ctltwavecaltype = wx.Choice(
                self.pnl, -1, choices=list(self.config.twavedict.values()))
            gbox1c.Add(self.ctltwavecaltype, (5, 1), span=(1, 1))
            gbox1c.Add(wx.StaticText(self.pnl, label="Calibration Type: "),
                       (5, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)

        sbs2.Add(gbox1c, 0, wx.EXPAND)
        ctlsizer.Add(sbs2, 0, wx.EXPAND)

        vbox2 = wx.BoxSizer(wx.VERTICAL)
        self.masspanel = IMListCtrlPanel(self.pnl)
        addbutton = wx.Button(self.pnl, label="Add Species")
        self.Bind(wx.EVT_BUTTON, self.on_add, addbutton)
        vbox2.Add(addbutton, 0, wx.EXPAND)
        vbox2.Add(self.masspanel, 0, wx.EXPAND)
        plotbutton = wx.Button(self.pnl, label="Plot Species")
        self.Bind(wx.EVT_BUTTON, self.on_plot, plotbutton)
        vbox2.Add(plotbutton, 0, wx.EXPAND)

        ctlsizer.Add(vbox2, -1, wx.EXPAND)

        sbs.Add(ctlsizer, 0, wx.EXPAND)
        self.pnl.SetSizer(sbs)

        hboxend = wx.BoxSizer(wx.HORIZONTAL)
        okbutton = wx.Button(self.pnl2, label='Ok')
        closebutton = wx.Button(self.pnl2, label='Cancel')
        okbutton.Bind(wx.EVT_BUTTON, self.on_close)
        closebutton.Bind(wx.EVT_BUTTON, self.on_close_cancel)
        hboxend.Add(okbutton)
        hboxend.Add(closebutton, flag=wx.LEFT, border=5)
        # TODO: There is a strange bug whereby the closebutton is not drawn when the window is flipped...
        self.pnl2.SetSizer(hboxend)

        vbox.Add(self.pnl, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
        vbox.Add(self.pnl2,
                 flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM,
                 border=10)

        self.SetSizer(vbox)
        vbox.Fit(self)

        self.load_to_gui(0)
示例#10
0
    def __init__(self, parent, id):

        wx.Frame.__init__(
            self,
            parent,
            id,
            'FMPUNO (Flash Memory Programmer UNO) - By Warber0x (github)',
            size=(900, 450),
            style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER ^ wx.MAXIMIZE_BOX
            ^ wx.MINIMIZE_BOX,
        )

        panel = wx.Panel(self, pos=(0, 100), size=(700, 200))
        self.percent = 0

        img = wx.Image('./avr.png')
        img.Rescale(170, 170)
        png = wx.Bitmap(img)
        wx.StaticBitmap(panel, -1, png, (713, 170),
                        (png.GetWidth(), png.GetHeight()))

        # Menu Gui

        status = self.CreateStatusBar()

        menubar = wx.MenuBar()
        filemenu = wx.Menu()
        editmenu = wx.Menu()
        aboutmenu = wx.Menu()

        exititem = filemenu.Append(wx.NewIdRef(), '&Exit', '')
        aboutitem = aboutmenu.Append(wx.NewIdRef(), '&About',
                                     ' Information about this program')
        edititem1 = editmenu.Append(wx.NewIdRef(), '&Read', '')
        edititem2 = editmenu.Append(wx.NewIdRef(), '&Erase', '')
        edititem3 = editmenu.Append(wx.NewIdRef(), '&Program', '')

        menubar.Append(filemenu, 'File')
        menubar.Append(editmenu, 'Edit')
        menubar.Append(aboutmenu, '?')

        self.SetMenuBar(menubar)
        self.Bind(wx.EVT_MENU, self.OnAbout, aboutitem)
        self.Bind(wx.EVT_MENU, self.OnExit, exititem)
        self.Bind(wx.EVT_MENU, self.OnRead, edititem1)
        self.Bind(wx.EVT_MENU, self.OnErase, edititem2)
        self.Bind(wx.EVT_MENU, self.OnProgram, edititem3)

        # End menubar

        # imageFile = "write.png"
        # imageFile2 = "read.png"
        # imageFile3 = "erase.png"
        # imageFile4 = "info.png"

        # imageWrite = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        # imageRead = wx.Image(imageFile2, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        # imageErase = wx.Image(imageFile3, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        # imageInfo = wx.Image(imageFile4, wx.BITMAP_TYPE_ANY).ConvertToBitmap()

        font3 = wx.Font(12, wx.NORMAL, wx.ITALIC, wx.BOLD)
        label6 = wx.StaticText(panel,
                               -1,
                               'IC Operations:', (10, 200),
                               size=(200, -1))
        label6.SetFont(font3)

        self.buttonProgram = wx.Button(panel,
                                       id=-1,
                                       label='Upload',
                                       pos=(50, 240),
                                       size=(65, 40))
        self.buttonRead = wx.Button(panel,
                                    id=-1,
                                    label='Read',
                                    pos=(50 + 65, 240),
                                    size=(65, 40))
        self.buttonErase = wx.Button(panel,
                                     id=-1,
                                     label='Erase',
                                     pos=(50, 280),
                                     size=(65, 40))
        self.buttonInfo = wx.Button(panel,
                                    id=-1,
                                    label='Infos',
                                    pos=(50 + 65, 280),
                                    size=(65, 40))

        self.textarea = wx.TextCtrl(panel,
                                    pos=(240, 10),
                                    style=wx.TE_MULTILINE | wx.TE_READONLY,
                                    size=(450, 265))

        font1 = wx.Font(12, wx.NORMAL, wx.ITALIC, wx.BOLD)
        label1 = wx.StaticText(panel,
                               -1,
                               'File to Upload', (10, 10),
                               size=(200, -1))
        label1.SetFont(font1)

        label4 = wx.StaticText(panel, -1, 'Game File: ', (10, 40))
        self.uploadText = wx.TextCtrl(panel,
                                      -1,
                                      pos=(85, 40),
                                      size=(100, -1),
                                      style=wx.TE_READONLY)
        buttonDlg = wx.Button(panel,
                              id=-1,
                              label='...',
                              pos=(185, 40),
                              size=(40, 30))

        self.ln = wx.StaticLine(panel,
                                -1,
                                pos=(20, 80),
                                size=(200, -1),
                                style=wx.LI_HORIZONTAL)

        font1 = wx.Font(12, wx.NORMAL, wx.ITALIC, wx.BOLD)
        label1 = wx.StaticText(panel,
                               -1,
                               'Parameters:', (10, 90),
                               size=(200, -1))
        label1.SetFont(font1)

        label3 = wx.StaticText(panel,
                               -1,
                               'Baude Rate: ', (10, 120),
                               size=(200, -1))
        baude = [
            '115200',
            '57600',
            '38400',
            '28800',
            '19200',
            '14400',
            '9600',
            '4800',
        ]
        self.baudBox = wx.ComboBox(
            panel,
            -1,
            pos=(100, 120),
            size=(100, -1),
            choices=baude,
            style=wx.CB_READONLY,
        )

        label5 = wx.StaticText(panel,
                               -1,
                               'Serial port: ', (10, 150),
                               size=(200, -1))
        arduinoSerial = ['ttyACM0', 'ttyACM1', 'ttyACM2', 'ttyACM3', 'ttyACM4']
        self.serialBox = wx.ComboBox(
            panel,
            -1,
            pos=(100, 150),
            size=(100, -1),
            choices=arduinoSerial,
            style=wx.CB_READONLY,
        )

        self.ln = wx.StaticLine(panel,
                                -1,
                                pos=(20, 190),
                                size=(200, 1),
                                style=wx.LI_HORIZONTAL)

        gaugeText = wx.StaticText(panel, -1, 'Progress %: ', (240, 283))
        self.gauge = wx.Gauge(panel, -1, 100, pos=(240, 300), size=(450, 25))

        # create a pubsub listener
        pub.subscribe(self.updateProgress, "update")

        font6 = wx.Font(12, wx.NORMAL, wx.ITALIC, wx.BOLD)
        label6 = wx.StaticText(panel, -1, 'IC Info', (710, 10), size=(200, -1))
        label6.SetFont(font6)

        label7 = wx.StaticText(panel, -1, 'Man ID: ', (710, 45))
        self.manid = wx.TextCtrl(panel,
                                 -1,
                                 pos=(770, 45),
                                 size=(120, -1),
                                 style=wx.TE_READONLY)

        label8 = wx.StaticText(panel, -1, 'Dev ID: ', (710, 80))
        self.devid = wx.TextCtrl(panel,
                                 -1,
                                 pos=(770, 80),
                                 size=(120, -1),
                                 style=wx.TE_READONLY)

        label2 = wx.StaticText(panel, -1, 'Brand : ', (710, 115))
        chip = ['AM29F010', 'AM29F040']
        self.flashref = wx.TextCtrl(panel,
                                    -1,
                                    pos=(770, 115),
                                    size=(120, -1),
                                    style=wx.TE_READONLY)

        self.ln = wx.StaticLine(panel,
                                -1,
                                pos=(700, 150),
                                size=(200, -1),
                                style=wx.LI_HORIZONTAL)

        self.Bind(wx.EVT_BUTTON, self.OnProgram, self.buttonProgram)
        self.Bind(wx.EVT_BUTTON, self.OnDlg, buttonDlg)
        self.Bind(wx.EVT_BUTTON, self.OnRead, self.buttonRead)
        self.Bind(wx.EVT_BUTTON, self.OnErase, self.buttonErase)
        self.Bind(wx.EVT_BUTTON, self.OnInfos, self.buttonInfo)
        self.Bind(wx.EVT_CLOSE, self.OnExit)

        self.intro = \
            '''ARDUINO AMD FLASH MEMORY PROGRAMMER - XXX29F0XX Series
            @Version: 1.0
            @Arduino ver: UNO
            @Python 3.9.1+
            @Author: https://github.com/warber0x

            Please connect your programmer, select the serial port, choose the baud rate and press one of the operations

            The programmed baudrate in this version is 115200 (Recommended)

            '''
        self.intro = self.intro.upper()
        self.textarea.SetValue(self.intro)

        self.count = 0
示例#11
0
 def createCaptionedText(self, panel, label, pos):
     static = wx.StaticText(panel, wx.NewId(), label, pos)
     static.SetBackgroundColour("White")
     textPos = (pos[0] + 75, pos[1])
     wx.TextCtrl(panel, wx.NewId(), "", size=(100, -1), pos=textPos)
    def InitUI(self):
        if self.mode=="DEBUG":
            print "In DischargeMeasurementsPanel"
        self.layoutSizer = wx.GridBagSizer(0, 0)
        self.locale = wx.Locale(self.lang)

        #Start Time Info
        startTimePanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        startTimePanel.SetBackgroundColour(self.BGColour)
        startTimeSizer = wx.BoxSizer(wx.VERTICAL)
        startTimeSizerH = wx.BoxSizer(wx.HORIZONTAL)
        
        startTimeTxt = wx.StaticText(startTimePanel, 1, label=self.startTimeLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        startTimeTxt.Wrap(self.wrapLength)
        # self.startTimeCtrl = masked.TimeCtrl(startTimePanel, 2, size=(-1, self.ctrlHeight), displaySeconds=False, fmt24hr = True)
        # # self.startTimeCtrl.SetValue(wx.DateTime_Now().FormatTime())
        # self.startTimeCtrl.Bind(wx.EVT_KEY_DOWN, self.OnResetTime)

        self.startTimeCtrl = DropdownTime(False, parent=startTimePanel, id=2, size=(-1, self.ctrlHeight))
        startTimeSizer.Add(startTimeTxt, 1, wx.EXPAND)
        startTimeSizer.Add(self.startTimeCtrl, 1, wx.EXPAND)
        startTimeSizerH.Add(startTimeSizer, 1, wx.EXPAND, 0)
        
        startTimePanel.SetSizer(startTimeSizerH)

        #End Time Info
        endTimePanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        endTimePanel.SetBackgroundColour(self.BGColour)
        endTimeSizer = wx.BoxSizer(wx.VERTICAL)
        endTimeSizerH = wx.BoxSizer(wx.HORIZONTAL)
        
        endTimeTxt = wx.StaticText(endTimePanel, 3, label=self.endTimeLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        endTimeTxt.Wrap(self.wrapLength)
        # self.endTimeCtrl = masked.TimeCtrl(endTimePanel, 4, size=(-1, self.ctrlHeight), displaySeconds=False, fmt24hr = True)
        # # self.endTimeCtrl.SetValue(wx.DateTime_Now().FormatTime())
        # self.endTimeCtrl.Bind(wx.EVT_KEY_DOWN, self.OnResetTime)
        self.endTimeCtrl = DropdownTime(False, parent=endTimePanel, id=4, size=(-1, self.ctrlHeight))
        endTimeSizer.Add(endTimeTxt, 1, wx.EXPAND)
        endTimeSizer.Add(self.endTimeCtrl, 1, wx.EXPAND)
        endTimeSizerH.Add(endTimeSizer, 1, wx.EXPAND)

        endTimePanel.SetSizer(endTimeSizerH)

        #Air Temperature Info
        airTempPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        airTempPanel.SetBackgroundColour(self.BGColour)
        airTempSizer = wx.BoxSizer(wx.VERTICAL)
        airTempSizerH = wx.BoxSizer(wx.HORIZONTAL)
        
        airTempTxt = wx.StaticText(airTempPanel, 5, label=self.airTempLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        airTempTxt.Wrap(self.wrapLength)
        self.airTempCtrl = MyTextCtrl(airTempPanel, 6, style=wx.TE_PROCESS_ENTER|wx.TE_CENTRE, size=(70, self.ctrlHeight))
        self.airTempCtrl.Bind(wx.EVT_TEXT, self.FloatNumberControl)
        self.airTempCtrl.Bind(wx.EVT_KILL_FOCUS, NumberControl.Round1)
        airTempSizer.Add(airTempTxt, 1, wx.EXPAND)
        airTempSizer.Add(self.airTempCtrl, 1, wx.EXPAND)
        airTempSizerH.Add(airTempSizer, 1, wx.EXPAND)

        airTempPanel.SetSizer(airTempSizerH)

        #Water Temperature Info
        waterTempPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        waterTempPanel.SetBackgroundColour(self.BGColour)
        waterTempSizer = wx.BoxSizer(wx.VERTICAL)
        waterTempSizerH = wx.BoxSizer(wx.HORIZONTAL)
         
        waterTempTxt = wx.StaticText(waterTempPanel, 7, label=self.waterTempLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        waterTempTxt.Wrap(self.wrapLength)
        self.waterTempCtrl = MyTextCtrl(waterTempPanel, 8, style=wx.TE_PROCESS_ENTER|wx.TE_CENTRE, size=(70, self.ctrlHeight))
        self.waterTempCtrl.Bind(wx.EVT_TEXT, self.FloatNumberControl)
        self.waterTempCtrl.Bind(wx.EVT_KILL_FOCUS, NumberControl.Round1)
        waterTempSizer.Add(waterTempTxt, 1, wx.EXPAND)
        waterTempSizer.Add(self.waterTempCtrl, 1, wx.EXPAND)
        waterTempSizerH.Add(waterTempSizer, 1, wx.EXPAND)

        waterTempPanel.SetSizer(waterTempSizerH)

        #Width Info
        widthPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        widthPanel.SetBackgroundColour(self.BGColour)
        widthSizer = wx.BoxSizer(wx.VERTICAL)
        widthSizerH = wx.BoxSizer(wx.HORIZONTAL)
        
        widthTxt = wx.StaticText(widthPanel, 9, label=self.widthLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        widthTxt.Wrap(self.wrapLength)
        self.widthCtrl = MyTextCtrl(widthPanel, 10, style=wx.TE_PROCESS_ENTER|wx.TE_CENTRE, size=(70, self.ctrlHeight))
        self.widthCtrl.Bind(wx.EVT_TEXT, self.FloatNumberControl)
        self.widthCtrl.Bind(wx.EVT_KILL_FOCUS, NumberControl.Sig3)
        widthSizer.Add(widthTxt, 1, wx.EXPAND)
        widthSizer.Add(self.widthCtrl, 1, wx.EXPAND)
        widthSizerH.Add(widthSizer, 1, wx.EXPAND)

        widthPanel.SetSizer(widthSizerH)

        #Area Info
        areaPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        areaPanel.SetBackgroundColour(self.BGColour)
        areaSizer = wx.BoxSizer(wx.VERTICAL)
        areaSizerH = wx.BoxSizer(wx.HORIZONTAL)
        
        areaTxt = wx.StaticText(areaPanel, 11, label=self.areaLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        areaTxt.Wrap(self.wrapLength)
        self.areaCtrl = MyTextCtrl(areaPanel, 12, style=wx.TE_PROCESS_ENTER|wx.TE_CENTRE, size=(70, self.ctrlHeight))
        self.areaCtrl.Bind(wx.EVT_TEXT, self.FloatNumberControl)
        self.areaCtrl.Bind(wx.EVT_KILL_FOCUS, NumberControl.Sig3)
        areaSizer.Add(areaTxt, 1, wx.EXPAND)
        areaSizer.Add(self.areaCtrl, 1, wx.EXPAND)
        areaSizerH.Add(areaSizer, 1, wx.EXPAND)

        areaPanel.SetSizer(areaSizerH)

        #Mean Velocity Info
        meanVelPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        meanVelPanel.SetBackgroundColour(self.BGColour)
        meanVelSizer = wx.BoxSizer(wx.VERTICAL)
        meanVelSizerH = wx.BoxSizer(wx.HORIZONTAL)
        
        meanVelTxt = wx.StaticText(meanVelPanel, 13, label=self.meanVelLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        meanVelTxt.Wrap(self.wrapLength)
        self.meanVelCtrl = MyTextCtrl(meanVelPanel, 14, style=wx.TE_PROCESS_ENTER|wx.TE_CENTRE, size=(85, self.ctrlHeight))
        self.meanVelCtrl.Bind(wx.EVT_TEXT, self.FloatNumberControl)
        self.meanVelCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnMeanVel)
        meanVelSizer.Add(meanVelTxt, 1, wx.EXPAND)
        meanVelSizer.Add(self.meanVelCtrl, 1, wx.EXPAND)
        meanVelSizerH.Add(meanVelSizer, 1, wx.EXPAND)

        meanVelPanel.SetSizer(meanVelSizerH)

        #Mean Gauge Height Info
        mghPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        mghPanel.SetBackgroundColour(self.BGColour)
        mghSizer = wx.BoxSizer(wx.VERTICAL)
        mghSizerH = wx.BoxSizer(wx.HORIZONTAL)
            
        cmghSizer = wx.BoxSizer(wx.HORIZONTAL)


        mghTxt = wx.StaticText(mghPanel, 15, label=self.mghLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height/2))
        self.correctMGHButton = wx.Button(mghPanel, size=(15, self.height/2), label="!")
        self.correctMGHButton.SetForegroundColour('red')
        self.correctMGHButton.Bind(wx.EVT_BUTTON, self.OnCMGHBtn)

        self.mghCmbo = wx.ComboBox(mghPanel, choices=self.mghChoices, style=wx.CB_READONLY, size=(-1, self.height/2))
        # set_trace()
        self.mghCmbo.Bind(wx.EVT_COMBOBOX, self.UpdateMGHCtrl)


        cmghSizer.Add(mghTxt, 1, wx.EXPAND)
        cmghSizer.Add(self.correctMGHButton, 0, wx.EXPAND)

        mghTxt.Wrap(self.wrapLength)
        
        self.mghCtrl = MyTextCtrl(mghPanel, 16, style=wx.TE_READONLY|wx.TE_CENTRE, size=(-1, self.ctrlHeight))



        mghSizer.Add(cmghSizer, 3, wx.EXPAND)
        mghSizer.Add(self.mghCmbo, 4, wx.EXPAND)
        mghSizer.Add(self.mghCtrl, 5, wx.EXPAND)
        mghSizerH.Add(mghSizer, 1, wx.EXPAND)

        mghPanel.SetSizer(mghSizerH)

        #Discharge Info
        dischPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        dischPanel.SetBackgroundColour(self.BGColour)
        dischSizer = wx.BoxSizer(wx.VERTICAL)
        dischSizer1 = wx.BoxSizer(wx.HORIZONTAL)
        dischSizerH = wx.BoxSizer(wx.HORIZONTAL)

        dischTxt = wx.StaticText(dischPanel, 17, label=self.dischLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        dischTxt.Wrap(self.wrapLength)
        self.dischCtrl = MyTextCtrl(dischPanel, 18, style=wx.TE_PROCESS_ENTER|wx.TE_CENTRE, size=(70, self.ctrlHeight))
        self.dischCtrl.Bind(wx.EVT_TEXT, self.FloatNumberControl)
        self.dischCtrl.Bind(wx.EVT_TEXT, self.OnChangeUpdateMovingBoat)
        self.dischCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnDischarge)
        self.dischCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnUpdateHGQValues)
        # self.dischCombo = wx.ComboBox(dischPanel, choices=self.dischChoices, style=wx.CB_READONLY, size=(32, self.ctrlHeight))

        dischSizer.Add(dischTxt, 1, wx.EXPAND)
        dischSizer1.Add(self.dischCtrl, 1, wx.EXPAND)
        # dischSizer1.Add(self.dischCombo, 0, wx.EXPAND)
        dischSizer.Add(dischSizer1, 1, wx.EXPAND)
        dischSizerH.Add(dischSizer, 1, wx.EXPAND)

        dischPanel.SetSizer(dischSizerH)


        #Uncertainty Info
        uncertaintyPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        uncertaintyPanel.SetBackgroundColour(self.BGColour)
        uncertaintySizer = wx.BoxSizer(wx.VERTICAL)
        uncertaintySizer1 = wx.BoxSizer(wx.HORIZONTAL)
        uncertaintySizerH = wx.BoxSizer(wx.HORIZONTAL)

        uncertaintyLabelSizerH = wx.BoxSizer(wx.HORIZONTAL)

        self.uncertaintyInfoBtn = wx.Button(uncertaintyPanel, size=(15, self.height/2), label="!")
        self.uncertaintyInfoBtn.SetForegroundColour('red')
        self.uncertaintyInfoBtn.Bind(wx.EVT_BUTTON, self.OnUncertaintyInfoBtn)

        uncertaintyTxt = wx.StaticText(uncertaintyPanel, 17, label=self.uncertaintyLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        uncertaintyTxt.Wrap(self.wrapLength)
        self.uncertaintyCtrl = MyTextCtrl(uncertaintyPanel, 18, style=wx.TE_PROCESS_ENTER|wx.TE_CENTRE, size=(70, self.ctrlHeight))
        self.uncertaintyCtrl.Bind(wx.EVT_TEXT, self.FloatNumberControl)
        # self.uncertaintyCtrl.Bind(wx.EVT_TEXT, self.OnChangeUpdateMovingBoat)
        self.uncertaintyCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnDischarge)
        self.uncertaintyCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnUpdateHGQValues)

        uncertaintyLabelSizerH.Add(uncertaintyTxt, 1, wx.EXPAND)
        uncertaintyLabelSizerH.Add(self.uncertaintyInfoBtn, 0, wx.EXPAND)

        uncertaintySizer.Add(uncertaintyLabelSizerH, 1, wx.EXPAND)
        uncertaintySizer1.Add(self.uncertaintyCtrl, 1, wx.EXPAND)
        uncertaintySizer.Add(uncertaintySizer1, 1, wx.EXPAND)

        uncertaintySizerH.Add(uncertaintySizer, 1, wx.EXPAND)

        uncertaintyPanel.SetSizer(uncertaintySizerH)



        #Mmt Mean Time Info
        mmtPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        mmtPanel.SetBackgroundColour(self.BGColour)
        mmtLblSubPanel = wx.Panel(mmtPanel)
        mmtValSubPanel = wx.Panel(mmtPanel, style=wx.BORDER_SUNKEN)
        
        mmtSizerH = wx.BoxSizer(wx.HORIZONTAL)
        mmtLblSubSizerH = wx.BoxSizer(wx.HORIZONTAL)
        mmtValSubSizerH = wx.BoxSizer(wx.HORIZONTAL)
        
        mmtTxt = wx.StaticText(mmtLblSubPanel, 19, label=self.mmtLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        mmtTxt.Wrap(self.wrapLength)
        self.mmtValTxt = wx.StaticText(mmtValSubPanel, 20, label='', style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.ctrlHeight))

        mmtLblSubSizerH.Add(mmtTxt, 1, wx.EXPAND)
        mmtLblSubPanel.SetSizer(mmtLblSubSizerH)
        mmtValSubSizerH.Add(self.mmtValTxt, 1, wx.EXPAND)
        mmtValSubPanel.SetSizer(mmtValSubSizerH)
        
        mmtSizerH.Add(mmtLblSubPanel, 1, wx.EXPAND)
        mmtSizerH.Add(mmtValSubPanel, 1, wx.EXPAND)

        mmtPanel.SetSizer(mmtSizerH)

        #Calc Shift Base Curve Info
        shiftPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        shiftPanel.SetBackgroundColour(self.BGColour)
        shiftSizerH = wx.BoxSizer(wx.HORIZONTAL)

        shiftTxt = wx.StaticText(shiftPanel, 21, label=self.shiftLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        shiftTxt.Wrap(self.wrapLength)
        self.shiftCtrl = MyTextCtrl(shiftPanel, 22, style=wx.TE_PROCESS_ENTER|wx.TE_CENTRE, size=(70, self.ctrlHeight))
        self.shiftCtrl.Bind(wx.EVT_TEXT, self.FloatNumberControl)
        self.shiftCtrl.Bind(wx.EVT_TEXT, self.OnChangeUpdateMovingBoat)

        shiftSizerH.Add(shiftTxt, 1, wx.EXPAND)
        shiftSizerH.Add(self.shiftCtrl, 1, wx.EXPAND)

        shiftPanel.SetSizer(shiftSizerH)

        #Difference Base Curve Info
        diffPanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        diffPanel.SetBackgroundColour(self.BGColour)
        diffSizerH = wx.BoxSizer(wx.HORIZONTAL)

        diffTxt = wx.StaticText(diffPanel, 23, label=self.diffLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        diffTxt.Wrap(self.wrapLength)
        self.diffCtrl = MyTextCtrl(diffPanel, 24, style=wx.TE_PROCESS_ENTER|wx.TE_CENTRE, size=(70, self.ctrlHeight))
        self.diffCtrl.Bind(wx.EVT_TEXT, self.FloatNumberControl)
        self.diffCtrl.Bind(wx.EVT_TEXT, self.OnChangeUpdateMovingBoat)

        diffSizerH.Add(diffTxt, 1, wx.EXPAND)
        diffSizerH.Add(self.diffCtrl, 1, wx.EXPAND)

        diffPanel.SetSizer(diffSizerH)

        #Curve Info
        curvePanel = wx.Panel(self, style=wx.SIMPLE_BORDER)
        curvePanel.SetBackgroundColour(self.BGColour)
        curveSizerG = wx.GridBagSizer(0, 0)

        curveTxt = wx.StaticText(curvePanel, 25, label=self.curveLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(-1, self.height))
        curveTxt.Wrap(self.wrapLength)
        
        self.curveCtrl = wx.ComboBox(curvePanel, 26, choices=self.curveList, style=wx.CB_DROPDOWN|wx.TE_PROCESS_ENTER|wx.TE_CENTRE, size=(120, self.ctrlHeight))
        self.curveCtrl.Bind(wx.EVT_TEXT, self.FloatNumberControl)
        self.curveCtrl.Bind(wx.EVT_TEXT, self.OnRCText)
        self.curveCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnRCKillFocus)
        self.curveCtrl.Bind(wx.EVT_COMBOBOX, self.OnRCCombo)
        curveSizerG.Add(curveTxt, pos=(0, 0), span=(1, 1), flag=wx.EXPAND)
        curveSizerG.Add(self.curveCtrl, pos=(0, 1), span=(1, 2), flag=wx.EXPAND)

        for i in range(2):
            curveSizerG.AddGrowableCol(i)
        for i in range(1):
            curveSizerG.AddGrowableRow(i)

        curvePanel.SetSizer(curveSizerG)





        #Control and Remarks
        controlConditionSizer = wx.BoxSizer(wx.HORIZONTAL)

        controlConditionPanel = wx.Panel(self, style=wx.SIMPLE_BORDER, size=(-1, self.height))
        controlConditionPanel.SetSizer(controlConditionSizer)

        controlTxt = wx.StaticText(controlConditionPanel, label=self.controlLbl, size=(80, self.height), style=wx.ALIGN_CENTRE_HORIZONTAL)
        controlTxt.SetForegroundColour("blue")
        controlTxt.SetBackgroundColour(self.BGColour)
        # controlTxt.SetBackgroundColour("gold")
        self.controlConditionCmbo = wx.ComboBox(controlConditionPanel, choices=self.contCondList, style=wx.CB_READONLY, size=(80, self.height))
        self.controlConditionCmbo.Bind(wx.EVT_MOUSEWHEEL, self.do_nothing)
        # self.picturedCkbox = wx.CheckBox(controlConditionPanel, label=self.picturedLbl)

        controlConditionSizer.Add(controlTxt, 1, wx.EXPAND)
        controlConditionSizer.Add(self.controlConditionCmbo, 1, wx.EXPAND)




        # #control condition remarks
        controlConditionRemarkSizer = wx.BoxSizer(wx.HORIZONTAL)
        controlConditionRemarkPanel = wx.Panel(self, style=wx.SIMPLE_BORDER, size=(-1, self.height * 1.2))
        controlConditionRemarkPanel.SetSizer(controlConditionRemarkSizer)


        controlConditionTxt = wx.StaticText(controlConditionRemarkPanel, label=self.controlConditionRemLbl, size=(200, self.height), style=wx.ALIGN_CENTRE_HORIZONTAL)
        self.controlConditionRemarksCtrl = wx.TextCtrl(controlConditionRemarkPanel, style=wx.TE_PROCESS_ENTER|wx.TE_MULTILINE|wx.TE_BESTWRAP, size=(-1, self.height * 1.2))
        controlConditionRemarkSizer.Add(controlConditionTxt, 0, wx.EXPAND)
        controlConditionRemarkSizer.Add(self.controlConditionRemarksCtrl, 1, wx.EXPAND)


        dischargeRemarkSizer = wx.BoxSizer(wx.HORIZONTAL)
        dischargeRemarkPanel = wx.Panel(self, style=wx.SIMPLE_BORDER, size=(-1, self.height * 1.2))
        dischargeRemarkPanel.SetSizer(dischargeRemarkSizer)

        self.dischTxt = wx.StaticText(dischargeRemarkPanel, label=self.dischRemarkLbl, style=wx.ALIGN_CENTRE_HORIZONTAL, size=(200, self.height))
        self.dischRemarksCtrl = wx.TextCtrl(dischargeRemarkPanel, style=wx.TE_PROCESS_ENTER|wx.TE_MULTILINE|wx.TE_BESTWRAP, size=(-1, self.height * 1.2))
        dischargeRemarkSizer.Add(self.dischTxt, 0)
        dischargeRemarkSizer.Add(self.dischRemarksCtrl, 1, wx.EXPAND)



        self.layoutSizer.Add(startTimePanel, pos=(0, 0), span=(2, 1), flag=wx.EXPAND)
        self.layoutSizer.Add(endTimePanel, pos=(0, 1), span=(2, 1), flag=wx.EXPAND)
        self.layoutSizer.Add(airTempPanel, pos=(0, 2), span=(2, 1), flag=wx.EXPAND)
        self.layoutSizer.Add(waterTempPanel, pos=(0, 3), span=(2, 1), flag=wx.EXPAND)
        self.layoutSizer.Add(widthPanel, pos=(0, 4), span=(2, 1), flag=wx.EXPAND)
        self.layoutSizer.Add(areaPanel, pos=(0, 5), span=(2, 1), flag=wx.EXPAND)
        self.layoutSizer.Add(meanVelPanel, pos=(0, 6), span=(2, 1), flag=wx.EXPAND)
        self.layoutSizer.Add(mghPanel, pos=(0, 7), span=(2, 1), flag=wx.EXPAND)
        self.layoutSizer.Add(dischPanel, pos=(0, 8), span=(2, 1), flag=wx.EXPAND)
        self.layoutSizer.Add(uncertaintyPanel, pos=(0, 9), span=(2, 1), flag=wx.EXPAND)
        self.layoutSizer.Add(mmtPanel, pos=(2, 0), span=(1, 2), flag=wx.EXPAND)
        self.layoutSizer.Add(shiftPanel, pos=(2, 2), span=(1, 2), flag=wx.EXPAND)
        self.layoutSizer.Add(diffPanel, pos=(2, 4), span=(1, 2), flag=wx.EXPAND)
        self.layoutSizer.Add(curvePanel, pos=(2, 6), span=(1, 4), flag=wx.EXPAND)


        self.layoutSizer.Add(controlConditionPanel, pos=(3, 0), span=(1, 2), flag=wx.EXPAND)
        self.layoutSizer.Add(controlConditionRemarkPanel, pos=(3, 2), span=(1, 8), flag=wx.EXPAND)
        self.layoutSizer.Add(dischargeRemarkPanel, pos=(4, 0), span=(1, 10), flag=wx.EXPAND)
        

        self.startTimeCtrl.GetHourCtrl().Bind(wx.EVT_COMBOBOX, self.OnTimeChange)
        self.startTimeCtrl.GetMinuteCtrl().Bind(wx.EVT_COMBOBOX, self.OnTimeChange)
        self.startTimeCtrl.GetHourCtrl().Bind(wx.EVT_KEY_UP, self.OnTimeChange)
        self.startTimeCtrl.GetMinuteCtrl().Bind(wx.EVT_KEY_UP, self.OnTimeChange)
        self.startTimeCtrl.cBtn.Bind(wx.EVT_BUTTON, self.OnCBtn)
        # self.startTimeCtrl.GetHourCtrl().Bind(wx.EVT_TEXT, self.OnTimeChange)
        # self.startTimeCtrl.GetMinuteCtrl().Bind(wx.EVT_TEXT, self.OnTimeChange)
        self.endTimeCtrl.GetHourCtrl().Bind(wx.EVT_COMBOBOX, self.OnTimeChange)
        self.endTimeCtrl.GetMinuteCtrl().Bind(wx.EVT_COMBOBOX, self.OnTimeChange)
        self.endTimeCtrl.GetHourCtrl().Bind(wx.EVT_KEY_UP, self.OnTimeChange)
        self.endTimeCtrl.GetMinuteCtrl().Bind(wx.EVT_KEY_UP, self.OnTimeChange)
        self.endTimeCtrl.cBtn.Bind(wx.EVT_BUTTON, self.OnCBtn)
        # self.endTimeCtrl.GetHourCtrl().Bind(wx.EVT_TEXT, self.OnTimeChange)
        # self.endTimeCtrl.GetMinuteCtrl().Bind(wx.EVT_TEXT, self.OnTimeChange)

        for i in range(9):
            self.layoutSizer.AddGrowableCol(i)

        for i in range(3):
            self.layoutSizer.AddGrowableRow(i)

        self.SetSizerAndFit(self.layoutSizer)
	def __init__(self, parent):
		self.parent = parent
		self.conf = parent.conf

		wx.Dialog.__init__(self, None, title=_('Deviation Table'),
						   size=(460, 450))
		self.Bind(wx.EVT_CLOSE, self.on_close)

		panel = wx.Panel(self)

		self.list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER)
		self.list.InsertColumn(0, _('CH'), width=65)
		self.list.InsertColumn(1, _('MH'), width=65)
		self.list.InsertColumn(2, _('deviation'), width=90)
		self.list.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.on_edit)

		variation_t = wx.StaticText(panel, label=_('Magnetic Variation'))
		self.variation = wx.TextCtrl(panel)

		self.fix = wx.Button(panel, label=_('Fix'))
		self.fix.Bind(wx.EVT_BUTTON, self.on_fix)

		rawvalue_t = wx.StaticText(panel, label=_('Compass Heading'))
		self.rawvalue = wx.TextCtrl(panel, size=(150, 30))

		mag_head_t = wx.StaticText(panel, label=_('Magnetic Heading'))
		self.mag_head = wx.TextCtrl(panel, size=(150, 30))

		unitvalue_t = wx.StaticText(panel, label=_('True Heading'))
		self.unitvalue = wx.TextCtrl(panel, size=(150, 30))
		
		self.change = wx.Button(panel, label=_('change'))
		self.change.Bind(wx.EVT_BUTTON, self.on_change)	

		reset = wx.Button(panel, label=_('Reset'))
		reset.Bind(wx.EVT_BUTTON, self.on_reset)

		close = wx.Button(panel, label=_('Close'))
		close.Bind(wx.EVT_BUTTON, self.on_close)

		graph = wx.Button(panel, label=_('graph'))
		graph.Bind(wx.EVT_BUTTON, self.on_graph)

		hvar = wx.BoxSizer(wx.HORIZONTAL)
		hvar.Add(self.variation, 0, wx.ALL | wx.EXPAND, 5)
		hvar.Add(self.fix, 0, wx.ALL | wx.EXPAND, 5)

		vb1 = wx.BoxSizer(wx.VERTICAL)
		vb1.Add(rawvalue_t, 0, wx.ALL | wx.EXPAND, 5)
		vb1.Add(self.rawvalue, 0, wx.ALL | wx.EXPAND, 5)
		vb1.Add(mag_head_t, 0, wx.ALL | wx.EXPAND, 5)
		vb1.Add(self.mag_head, 0, wx.ALL | wx.EXPAND, 5)
		vb1.Add(variation_t, 0, wx.ALL | wx.EXPAND, 5)
		vb1.Add(hvar, 0, wx.ALL | wx.EXPAND, 0)
		vb1.Add(unitvalue_t, 0, wx.ALL | wx.EXPAND, 5)
		vb1.Add(self.unitvalue, 0, wx.ALL | wx.EXPAND, 5)
		vb1.AddSpacer(10)
		vb1.Add(self.change, 0, wx.ALL | wx.EXPAND, 5)
		

		hlistbox = wx.BoxSizer(wx.HORIZONTAL)
		hlistbox.Add(self.list, 1, wx.ALL | wx.EXPAND, 5)
		hlistbox.Add(vb1, 0, wx.ALL | wx.EXPAND, 5)

		hbox = wx.BoxSizer(wx.HORIZONTAL)
		hbox.Add((0, 0), 1, wx.ALL | wx.EXPAND, 5)
		hbox.Add(reset, 0, wx.ALL | wx.EXPAND, 5)
		hbox.Add(graph, 0, wx.ALL | wx.EXPAND, 5)
		hbox.Add(close, 0, wx.ALL | wx.EXPAND, 5)

		vbox = wx.BoxSizer(wx.VERTICAL)
		vbox.AddSpacer(5)
		vbox.Add(hlistbox, 1, wx.RIGHT | wx.LEFT | wx.EXPAND, 5)
		vbox.AddSpacer(5)
		vbox.Add((0, 0), 1, wx.ALL | wx.EXPAND, 0)
		vbox.Add(hbox, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 5)

		panel.SetSizer(vbox)
		self.rawvalue.Disable()
		self.mag_head.Disable()
		self.selected = self.list.GetFirstSelected()

		self.read_list()
示例#14
0
    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, 'grid_test', size=(700, 600))
        self.Bind(wx.EVT_CLOSE, self.on_close)
        panel = wx.Panel(self, wx.ID_ANY)
        self.grid = wx.grid.Grid(panel)
        self.grid.CreateGrid(len(self.data), 5)
        self.grid.SetRowSize(0, 40)
        self.grid.SetColSize(1, 150)
        self.grid.SetColSize(2, 100)
        self.grid.SetColSize(3, 100)
        self.grid.SetColSize(4, 200)
        self.grid.SetColLabelValue(0, 'id')
        self.grid.SetColLabelValue(1, '文本')
        self.grid.SetColLabelValue(2, '组合公式')
        self.grid.SetColLabelValue(3, '备注')
        self.grid.SetColLabelValue(4, 'date')
        self.row = 0
        self.col = 0
        for i in range(len(self.data)):
            # print(self.data[i])
            cell_1 = self.data[i].split('"')
            # print(cell_1)
            cell_2 = cell_1[2].split("'")
            # for i in range(len(cell_2)):
            #     print(i, cell_2[i])
            cell_3 = cell_2[-1].split(",")
            cell_4 = cell_3[-1].split(')')
            cell_4 = cell_4[0].split(" ")
            cell_5 = cell_3[1].split(" ")
            # print(cell_3)
            self.grid.SetCellValue(i, 0, cell_4[1])
            self.grid.SetCellValue(i, 1, cell_1[1])
            self.grid.SetCellValue(i, 2, cell_2[1])
            self.grid.SetCellValue(i, 3, cell_2[3])
            time_2 = datetime.datetime.fromtimestamp(float(cell_5[1]))
            self.grid.SetCellValue(
                i, 4, datetime.datetime.strftime(time_2, "%Y-%m-%d %H:%M:%S"))
        self.grid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.show_pop_menu)
        self.grid.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.select_cell)
        sizer = wx.BoxSizer(wx.VERTICAL)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        spin = wx.StaticText(panel,
                             -1,
                             "按字母排序",
                             pos=wx.DefaultPosition,
                             size=wx.DefaultSize)
        font = wx.Font(18, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_ITALIC,
                       wx.FONTWEIGHT_NORMAL)
        spin.SetFont(font)
        hbox.Add(spin)
        sc = wx.SpinButton(panel, -1, pos=wx.DefaultPosition, size=(30, 30))
        sc.Bind(wx.EVT_SPIN_UP, self.sort_by_up_spin)
        sc.Bind(wx.EVT_SPIN_DOWN, self.sort_by_down_spin)
        hbox.Add(sc)
        spin2 = wx.StaticText(panel,
                              -1,
                              "按时间排序",
                              pos=wx.DefaultPosition,
                              size=wx.DefaultSize)
        font = wx.Font(18, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_ITALIC,
                       wx.FONTWEIGHT_NORMAL)
        spin2.SetFont(font)
        hbox.Add(spin2)
        sc2 = wx.SpinButton(panel, -1, pos=wx.DefaultPosition, size=(30, 30))
        sc2.Bind(wx.EVT_SPIN_UP, self.sort_by_up_spin_time)
        sc2.Bind(wx.EVT_SPIN_DOWN, self.sort_by_down_spin_time)
        hbox.Add(sc2)
        sizer.Add(self.grid, -1, wx.EXPAND, 2)
        sizer.Add(hbox)
        panel.SetSizer(sizer)

        self.select_id = self.grid.GetCellValue(self.row, 0)
示例#15
0
文件: gui.py 项目: luaffjk/AQC.GUI
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=u"Aplicativo de Avaliação de Qualidade Visual",
                          pos=wx.DefaultPosition,
                          size=wx.Size(500, 720),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        bSizer1 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText1 = wx.StaticText(self, wx.ID_ANY,
                                           u"Diretório de Imagens Originais",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText1.Wrap(-1)
        bSizer1.Add(self.m_staticText1, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                    5)

        self.text = wx.DirPickerCtrl(self, wx.ID_ANY, wx.EmptyString,
                                     u"Select a folder", wx.DefaultPosition,
                                     wx.DefaultSize, wx.DIRP_DEFAULT_STYLE)
        bSizer1.Add(self.text, 0, wx.ALL | wx.EXPAND, 5)

        self.m_staticText2 = wx.StaticText(self, wx.ID_ANY,
                                           u"Diretório de Imagens de Teste",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText2.Wrap(-1)
        bSizer1.Add(self.m_staticText2, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                    5)

        self.text1 = wx.DirPickerCtrl(self, wx.ID_ANY, wx.EmptyString,
                                      u"Select a folder", wx.DefaultPosition,
                                      wx.DefaultSize, wx.DIRP_DEFAULT_STYLE)
        bSizer1.Add(self.text1, 0, wx.ALL | wx.EXPAND, 5)

        self.m_staticText3 = wx.StaticText(
            self, wx.ID_ANY, u"Diretório de Arquivo (avaliação subjetiva)",
            wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText3.Wrap(-1)
        bSizer1.Add(self.m_staticText3, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                    5)

        self.text2 = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString,
                                       u"Select a file", u"*.*",
                                       wx.DefaultPosition, wx.DefaultSize,
                                       wx.FLP_DEFAULT_STYLE)
        bSizer1.Add(self.text2, 0, wx.ALL | wx.EXPAND, 5)

        self.m_staticline2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition,
                                           wx.DefaultSize, wx.LI_HORIZONTAL)
        bSizer1.Add(self.m_staticline2, 0, wx.EXPAND | wx.ALL, 5)

        self.m_staticText6 = wx.StaticText(self, wx.ID_ANY, u"Métricas",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText6.Wrap(-1)
        bSizer1.Add(self.m_staticText6, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                    5)

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

        self.m_checkBox8 = wx.CheckBox(self, wx.ID_ANY, u"PSNR",
                                       wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer3.Add(self.m_checkBox8, 0, wx.ALL, 5)

        self.m_checkBox9 = wx.CheckBox(self, wx.ID_ANY, u"MSE",
                                       wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer3.Add(self.m_checkBox9, 0, wx.ALL, 5)

        self.m_checkBox10 = wx.CheckBox(self, wx.ID_ANY, u"MSSIM",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer3.Add(self.m_checkBox10, 0, wx.ALL, 5)

        self.m_checkBox11 = wx.CheckBox(self, wx.ID_ANY, u"UQI",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer3.Add(self.m_checkBox11, 0, wx.ALL, 5)

        self.m_checkBox12 = wx.CheckBox(self, wx.ID_ANY, u"SNR",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer3.Add(self.m_checkBox12, 0, wx.ALL, 5)

        self.m_checkBox13 = wx.CheckBox(self, wx.ID_ANY, u"PBVIF",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer3.Add(self.m_checkBox13, 0, wx.ALL, 5)

        self.m_checkBox14 = wx.CheckBox(self, wx.ID_ANY, u"NQM",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer3.Add(self.m_checkBox14, 0, wx.ALL, 5)

        self.m_checkBox15 = wx.CheckBox(self, wx.ID_ANY, u"RMSE",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer3.Add(self.m_checkBox15, 0, wx.ALL, 5)

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

        self.m_staticline3 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition,
                                           wx.DefaultSize, wx.LI_HORIZONTAL)
        bSizer1.Add(self.m_staticline3, 0, wx.EXPAND | wx.ALL, 5)

        self.m_staticText7 = wx.StaticText(self, wx.ID_ANY, u"Regressões",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText7.Wrap(-1)
        bSizer1.Add(self.m_staticText7, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                    5)

        self.m_checkBox16 = wx.CheckBox(self, wx.ID_ANY, u"Regressão Linear",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_checkBox16, 0, wx.ALL, 5)

        self.m_checkBox17 = wx.CheckBox(self, wx.ID_ANY,
                                        u"Regressão Logística",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_checkBox17, 0, wx.ALL, 5)

        self.m_staticline4 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition,
                                           wx.DefaultSize, wx.LI_HORIZONTAL)
        bSizer1.Add(self.m_staticline4, 0, wx.EXPAND | wx.ALL, 5)

        self.m_staticText8 = wx.StaticText(self, wx.ID_ANY, u"Avaliação",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText8.Wrap(-1)
        bSizer1.Add(self.m_staticText8, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                    5)

        self.m_checkBox18 = wx.CheckBox(self, wx.ID_ANY,
                                        u"Correlação de Pearson",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_checkBox18, 0, wx.ALL, 5)

        self.m_checkBox19 = wx.CheckBox(self, wx.ID_ANY,
                                        u"Correlação de Spearman",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_checkBox19, 0, wx.ALL, 5)

        self.m_checkBox20 = wx.CheckBox(self, wx.ID_ANY, u"Razão de Outliers",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_checkBox20, 0, wx.ALL, 5)

        self.m_checkBox21 = wx.CheckBox(self, wx.ID_ANY,
                                        u"Analise de Variancia",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_checkBox21, 0, wx.ALL, 5)

        self.m_staticline5 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition,
                                           wx.DefaultSize, wx.LI_HORIZONTAL)
        bSizer1.Add(self.m_staticline5, 0, wx.EXPAND | wx.ALL, 5)

        self.m_staticText9 = wx.StaticText(self, wx.ID_ANY, u"Gráficos",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText9.Wrap(-1)
        bSizer1.Add(self.m_staticText9, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                    5)

        self.m_checkBox22 = wx.CheckBox(self, wx.ID_ANY, u"Traçar Gráficos",
                                        wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_checkBox22, 0, wx.ALL, 5)

        self.solveButton = wx.Button(self, wx.ID_ANY, u"Iniciar Avaliação",
                                     wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.solveButton, 0, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(bSizer1)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.solveButton.Bind(wx.EVT_BUTTON, self.solveFunc)
示例#16
0
    def initialize_interface(self, massdat, ccsdat, mccsgrid, config, pks):
        """
        Initilizes the interface and plots the intial results.
        :param massdat: Mass distribution array (N x 2)
        :param ccsdat: CCS distribution array (M x 2)
        :param mccsgrid: Array of intensity values for corresponding mass and CCS values (N x M) array
        :param config: UniDecConfig object
        :param pks: Peaks object
        :return: None
        """
        self.config = config
        self.massdat = massdat
        self.ccsdat = ccsdat
        self.totalgrid = mccsgrid
        self.pks = pks
        self.ztab = np.arange(float(self.config.startz),
                              float(self.config.endz + 1))
        zstrings = [str(int(z)) for z in self.ztab]
        zstrings.append("All")

        pnl = wx.Panel(self)

        vbox = wx.BoxSizer(wx.VERTICAL)
        sb = wx.StaticBox(pnl, label='Ion Mobility Extraction Tool')
        sbs = wx.StaticBoxSizer(sb, orient=wx.HORIZONTAL)
        figsize = (6, 5)
        self.plot1 = plot2d.Plot2d(pnl, figsize=figsize)
        self.plot2 = plot1d.Plot1d(pnl, figsize=figsize)
        plotsizer = wx.BoxSizer(wx.VERTICAL)
        plotsizer.Add(self.plot1, 0, wx.EXPAND)
        plotsizer.Add(self.plot2, 0, wx.EXPAND)
        sbs.Add(plotsizer, 0, wx.EXPAND)

        sb2 = wx.StaticBox(pnl, label='Extraction Parameters')
        sbs2 = wx.StaticBoxSizer(sb2, orient=wx.VERTICAL)
        gbox1c = wx.GridBagSizer(wx.VERTICAL)
        size1 = (75, -1)

        self.ctlzout = wx.ComboBox(pnl, value="", size=size1, choices=zstrings)
        gbox1c.Add(self.ctlzout, (0, 1), span=(1, 1))
        gbox1c.Add(wx.StaticText(pnl, label="Charge State: "), (0, 0),
                   flag=wx.ALIGN_CENTER_VERTICAL)

        sbs2.Add(gbox1c, 0, wx.EXPAND)

        self.masspanel = IMListCtrlPanel(pnl, size=(200, 700))
        addbutton = wx.Button(pnl, label="Add Species")
        plotbutton = wx.Button(pnl, label="Plot Species")
        sbs2.Add(plotbutton, 0, wx.EXPAND)
        sbs2.Add(self.masspanel, 0, wx.EXPAND)
        sbs2.Add(addbutton, 0, wx.EXPAND)
        self.Bind(wx.EVT_BUTTON, self.on_add, addbutton)
        self.Bind(wx.EVT_BUTTON, self.on_plot, plotbutton)

        sbs.Add(sbs2, 0, wx.EXPAND)
        pnl.SetSizer(sbs)

        hboxend = wx.BoxSizer(wx.HORIZONTAL)
        okbutton = wx.Button(self, label='Ok')
        closebutton = wx.Button(self, label='Cancel')
        okbutton.Bind(wx.EVT_BUTTON, self.on_close)
        closebutton.Bind(wx.EVT_BUTTON, self.on_close_cancel)
        hboxend.Add(okbutton)
        hboxend.Add(closebutton, flag=wx.LEFT, border=5)
        vbox.Add(pnl, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
        vbox.Add(hboxend, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=10)

        self.SetSizer(vbox)
        vbox.Fit(self)

        self.CenterOnParent()
        self.loadpeaks(0)
        self.on_plot(0)
        self.ctlzout.SetSelection(len(zstrings) - 1)
示例#17
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=u"Add",
                          pos=wx.DefaultPosition,
                          size=wx.Size(373, 233),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        bSizer4 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer4.SetMinSize(wx.Size(400, 400))
        fgSizer1 = wx.FlexGridSizer(3, 0, 0, 0)
        fgSizer1.SetFlexibleDirection(wx.BOTH)
        fgSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        bSizer21 = wx.BoxSizer(wx.HORIZONTAL)

        self.addtip1 = wx.StaticText(self, wx.ID_ANY,
                                     u"Please enter the name you want to add",
                                     wx.DefaultPosition, wx.Size(-1, -1),
                                     wx.ALIGN_CENTRE)
        self.addtip1.Wrap(-1)
        self.addtip1.SetFont(
            wx.Font(wx.NORMAL_FONT.GetPointSize(), wx.FONTFAMILY_DEFAULT,
                    wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False,
                    wx.EmptyString))

        bSizer21.Add(
            self.addtip1, 0,
            wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)

        fgSizer1.Add(bSizer21, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 5)

        bSizer111 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer131 = wx.BoxSizer(wx.VERTICAL)

        self.addname1 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                    wx.DefaultPosition, wx.Size(200, -1), 0)
        bSizer131.Add(self.addname1, 0, wx.ALIGN_CENTER | wx.ALL | wx.TOP, 10)

        bSizer111.Add(bSizer131, 1,
                      wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 5)

        fgSizer1.Add(
            bSizer111, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL
            | wx.ALL | wx.EXPAND, 5)

        self.addconfirm1 = wx.Button(self, wx.ID_ANY, u"confirm",
                                     wx.DefaultPosition, wx.DefaultSize, 0)
        fgSizer1.Add(
            self.addconfirm1, 0,
            wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5)

        bSizer4.Add(fgSizer1, 1, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(bSizer4)
        self.Layout()

        self.Centre(wx.BOTH)
示例#18
0
    def run_as_data_tool(self):
        '''Run the module as a data tool'''
        import wx
        from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin
        from cellprofiler.gui import get_cp_icon

        #
        # Portions of this were cribbed from the wx listctrl demo code
        # which is part of the wx source distribution
        #
        class AWListCtrl(wx.ListCtrl, ListCtrlAutoWidthMixin):
            '''A list control with autosizing of the last column'''
            def __init__(self,
                         parent,
                         ID=wx.ID_ANY,
                         pos=wx.DefaultPosition,
                         size=wx.DefaultSize,
                         style=0):
                wx.ListCtrl.__init__(self, parent, ID, pos, size, style)
                ListCtrlAutoWidthMixin.__init__(self)

        dlg = wx.Dialog(None,
                        title="Merge output files",
                        size=(640, 480),
                        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                        | wx.THICK_FRAME)
        dlg.SetIcon(get_cp_icon())
        #
        # Layout:
        # Dialog box
        #    sizer (vertical)
        #        list-control
        #        sizer (horizontal)
        #            Add...
        #            Remove
        #            Up
        #            Down
        #            button sizer
        #                OK
        #                Cancel
        #
        dlg.Sizer = sizer = wx.BoxSizer(wx.VERTICAL)
        subsizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(subsizer, 0, wx.EXPAND | wx.ALL, 5)
        subsizer.Add(wx.StaticText(dlg, -1, "Destination file:"), 0,
                     wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 3)
        dest_file_ctrl = wx.TextCtrl(dlg)
        subsizer.Add(dest_file_ctrl, 1, wx.EXPAND | wx.LEFT, 3)
        browse_button = wx.Button(dlg, -1, "Browse...")
        subsizer.Add(browse_button, 0, wx.EXPAND)
        list_control = AWListCtrl(dlg, style=wx.LC_REPORT)
        if sys.platform == 'darwin':
            list_control.InsertColumn(0, "Folder", width=200)
            list_control.InsertColumn(1, "File", width=-1)
        else:
            list_control.InsertColumn(0,
                                      "Folder",
                                      format=wx.LC_ALIGN_LEFT,
                                      width=200)
            list_control.InsertColumn(1,
                                      "File",
                                      format=wx.LC_ALIGN_LEFT,
                                      width=-1)
        sizer.Add(list_control, 1, wx.EXPAND | wx.ALL, 5)
        sizer.Add(wx.StaticLine(dlg), 0, wx.EXPAND)
        subsizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(subsizer, 0, wx.EXPAND | wx.ALL, 5)
        add_button = wx.Button(dlg, -1, "Add...")
        subsizer.Add(add_button, 0, wx.ALIGN_CENTER_HORIZONTAL)
        remove_button = wx.Button(dlg, wx.ID_REMOVE, "Remove selected")
        subsizer.Add(remove_button, 0, wx.ALIGN_CENTER_HORIZONTAL)
        up_button = wx.Button(dlg, wx.ID_UP, "Up")
        subsizer.Add(up_button, 0, wx.ALIGN_CENTER_HORIZONTAL)
        down_button = wx.Button(dlg, wx.ID_DOWN, "Down")
        subsizer.Add(down_button, 0, wx.ALIGN_CENTER_HORIZONTAL)

        button_sizer = wx.StdDialogButtonSizer()
        button_sizer.AddButton(wx.Button(dlg, wx.ID_OK))
        button_sizer.AddButton(wx.Button(dlg, wx.ID_CANCEL))
        help_button = wx.Button(dlg, wx.ID_HELP)
        button_sizer.AddButton(help_button)
        button_sizer.Realize()
        subsizer.Add(button_sizer, 0, wx.ALIGN_RIGHT)
        dlg.Layout()
        #
        # Order is a map of item ID to its position in the list control
        #
        order = {}

        add_button.Bind(wx.EVT_BUTTON,
                        lambda event: self.on_add(event, list_control, order))
        remove_button.Bind(
            wx.EVT_BUTTON,
            lambda event: self.on_remove(event, list_control, order))
        browse_button.Bind(wx.EVT_BUTTON,
                           lambda event: self.on_browse(event, dest_file_ctrl))
        up_button.Bind(wx.EVT_BUTTON,
                       lambda event: self.on_up(event, list_control, order))
        down_button.Bind(
            wx.EVT_BUTTON,
            lambda event: self.on_down(event, list_control, order))
        help_button.Bind(wx.EVT_BUTTON,
                         lambda event: self.on_help(event, list_control))

        if dlg.ShowModal() == wx.ID_OK:
            sources = []
            for i in range(list_control.ItemCount):
                item_id = list_control.GetItemData(i)
                path = list_control.GetItem(i, 0).GetText()
                filename = list_control.GetItem(i, 1).GetText()
                sources.append(os.path.join(path, filename))
            self.merge_files(dest_file_ctrl.Value, sources)
        dlg.Destroy()
示例#19
0
    def __init__(self, parent, variables):

        wx.Dialog.__init__(self, parent, title="Float Compare")

        self.operations = ["+", "-", "*", "/", "^", "(", ")"]
        self._variables = variables

        panel = wx.Panel(self)
        sizer = wx.BoxSizer(wx.VERTICAL)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        sbox = wx.StaticBox(panel, label="")
        sbox_sizer = wx.StaticBoxSizer(sbox, wx.HORIZONTAL)
        grid = wx.GridBagSizer(5, 5)

        row = 0
        lbl_var1 = wx.StaticText(panel, label="variables:")
        grid.Add(lbl_var1, pos=(row, 0), flag=wx.ALL | wx.EXPAND, border=2)

        choices = variables["locals"]
        for var in variables["globals"]:
            if var in choices:
                continue
            choices.append(var)
        choices = sorted(choices)

        cbox_vars1 = wx.ComboBox(panel,
                                 choices=choices,
                                 name="var1",
                                 style=wx.CB_READONLY)
        cbox_vars1.Bind(wx.EVT_COMBOBOX, self.OnVarSelected)
        grid.Add(cbox_vars1, pos=(row, 1), flag=wx.ALL | wx.EXPAND, border=2)

        row += 1
        var1_hsizer = wx.BoxSizer(wx.HORIZONTAL)
        for label in self.operations:
            btn = wx.Button(panel, label=label, name="var1", size=(36, 22))
            btn.Bind(wx.EVT_BUTTON, self.OnOperationButton)
            var1_hsizer.Add(btn, 0, wx.ALL, 0)
        grid.Add(var1_hsizer, pos=(row, 1), flag=wx.ALL, border=2)

        row += 1
        lbl_var1 = wx.StaticText(panel, label="var1 = ")
        self.text_var1 = wx.TextCtrl(panel, value="")
        self.text_var1.Bind(wx.EVT_TEXT, self.OnVarTextChange)
        grid.Add(lbl_var1,
                 pos=(row, 0),
                 flag=wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTRE,
                 border=2)
        grid.Add(self.text_var1,
                 pos=(row, 1),
                 span=(0, 1),
                 flag=wx.ALL | wx.EXPAND,
                 border=2)

        sbox_sizer.Add(grid, 1, wx.ALL | wx.EXPAND, 0)

        #-----

        sbox = wx.StaticBox(panel, label="")
        sbox_sizer2 = wx.StaticBoxSizer(sbox, wx.HORIZONTAL)
        grid2 = wx.GridBagSizer(5, 5)

        row = 0
        lbl_var2 = wx.StaticText(panel, label="variables:")
        grid2.Add(lbl_var2, pos=(row, 0), flag=wx.ALL | wx.EXPAND, border=2)

        cbox_vars2 = wx.ComboBox(panel,
                                 choices=choices,
                                 name="var2",
                                 style=wx.CB_READONLY)
        cbox_vars2.Bind(wx.EVT_COMBOBOX, self.OnVarSelected)
        grid2.Add(cbox_vars2, pos=(row, 1), flag=wx.ALL | wx.EXPAND, border=2)

        row += 1
        var2_hsizer = wx.BoxSizer(wx.HORIZONTAL)
        for label in self.operations:
            btn = wx.Button(panel, label=label, name="var2", size=(36, 22))
            btn.Bind(wx.EVT_BUTTON, self.OnOperationButton)
            var2_hsizer.Add(btn, 0, wx.ALL, 0)

        grid2.Add(var2_hsizer, pos=(row, 1), flag=wx.ALL, border=2)

        row += 1
        lbl_var2 = wx.StaticText(panel, label="var2 = ")
        self.text_var2 = wx.TextCtrl(panel, value="")
        self.text_var2.Bind(wx.EVT_TEXT, self.OnVarTextChange)
        grid2.Add(lbl_var2,
                  pos=(row, 0),
                  flag=wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTRE,
                  border=2)
        grid2.Add(self.text_var2,
                  pos=(row, 1),
                  span=(0, 1),
                  flag=wx.ALL | wx.EXPAND,
                  border=2)

        sbox_sizer2.Add(grid2, 1, wx.ALL | wx.EXPAND, 0)

        hsizer.Add(sbox_sizer, 1, wx.ALL | wx.EXPAND, 0)
        hsizer.Add(sbox_sizer2, 1, wx.ALL | wx.EXPAND, 0)

        # -----
        sbox = wx.StaticBox(panel, label="Pass/Fail")
        sbox_sizer3 = wx.StaticBoxSizer(sbox, wx.HORIZONTAL)
        grid3 = wx.GridBagSizer(5, 5)

        row = 0
        lbl_test = wx.StaticText(panel, label="Test:")
        self.cbox_var_x = wx.ComboBox(panel,
                                      choices=["var1", "var2"],
                                      value="var1",
                                      style=wx.CB_READONLY)
        self.cbox_cond = wx.ComboBox(panel,
                                     choices=["=", ">", "<", ">=", "<="],
                                     value="=",
                                     style=wx.CB_READONLY)
        self.cbox_var_y = wx.ComboBox(panel,
                                      choices=["var1", "var2"],
                                      value="var2",
                                      style=wx.CB_READONLY)
        grid3.Add(lbl_test, pos=(row, 0), flag=wx.ALL | wx.EXPAND, border=2)
        grid3.Add(self.cbox_var_x,
                  pos=(row, 1),
                  flag=wx.ALL | wx.EXPAND,
                  border=2)
        grid3.Add(self.cbox_cond,
                  pos=(row, 2),
                  flag=wx.ALL | wx.EXPAND,
                  border=2)
        grid3.Add(self.cbox_var_y,
                  pos=(row, 3),
                  flag=wx.ALL | wx.EXPAND,
                  border=2)

        row = 1
        lbl_decimal = wx.StaticText(panel, label="Decimal point(s):")
        self.spin_decimal = wx.SpinCtrl(panel, max=99, min=0, value="3")
        grid3.Add(lbl_decimal, pos=(row, 0), flag=wx.ALL | wx.EXPAND, border=2)
        grid3.Add(self.spin_decimal,
                  pos=(row, 1),
                  flag=wx.ALL | wx.EXPAND,
                  border=2)

        row += 2
        choices = ["continue", "terminate"]
        lbl_pass = wx.StaticText(panel, label="On Pass:"******"continue",
                                       style=wx.CB_READONLY)
        grid3.Add(lbl_pass, pos=(row, 0), flag=wx.ALL | wx.EXPAND, border=2)
        grid3.Add(self.cbox_onpass,
                  pos=(row, 1),
                  flag=wx.ALL | wx.EXPAND,
                  border=2)

        row += 1
        lbl_failure = wx.StaticText(panel, label="On Failure:")
        self.cbox_onfailure = wx.ComboBox(panel,
                                          choices=choices,
                                          value="continue",
                                          style=wx.CB_READONLY)
        grid3.Add(lbl_failure, pos=(row, 0), flag=wx.ALL | wx.EXPAND, border=2)
        grid3.Add(self.cbox_onfailure,
                  pos=(row, 1),
                  flag=wx.ALL | wx.EXPAND,
                  border=2)

        row += 2
        lbl_local = wx.StaticText(panel, label="Local Name:")
        default = defaultname = "test"
        index = 1
        while defaultname in self._variables["locals"]:
            defaultname = default + str(index)
            index += 1
        self.text_local = wx.TextCtrl(panel, value=defaultname)
        grid3.Add(lbl_local, pos=(row, 0), flag=wx.ALL | wx.EXPAND, border=5)
        grid3.Add(self.text_local,
                  pos=(row, 1),
                  span=(0, 2),
                  flag=wx.ALL | wx.EXPAND,
                  border=5)

        row += 1
        lbl_global = wx.StaticText(panel, label="Global Name:")
        self.text_global = wx.TextCtrl(panel, value="")
        grid3.Add(lbl_global, pos=(row, 0), flag=wx.ALL | wx.EXPAND, border=5)
        grid3.Add(self.text_global,
                  pos=(row, 1),
                  span=(0, 2),
                  flag=wx.ALL | wx.EXPAND,
                  border=5)

        # grid3.AddGrowableCol(0)
        grid3.AddGrowableCol(1)
        grid3.AddGrowableCol(2)
        grid3.AddGrowableCol(3)
        # grid3.AddGrowableCol(4)

        sbox_sizer3.Add(grid3, 1, wx.ALL | wx.EXPAND, 0)

        #-----
        hsizer_controls = wx.BoxSizer(wx.HORIZONTAL)
        hsizer_controls.AddStretchSpacer()
        btn_cancel = wx.Button(panel, label="Cancel", id=wx.ID_CANCEL)
        btn_cancel.Bind(wx.EVT_BUTTON, self.OnButton)
        self.btn_add = wx.Button(panel, label="Add", id=wx.ID_OK)
        self.btn_add.Bind(wx.EVT_BUTTON, self.OnButton)
        # self.btn_add.Disable()
        hsizer_controls.Add(btn_cancel, 0, wx.ALL | wx.EXPAND, 5)
        hsizer_controls.Add(self.btn_add, 0, wx.ALL | wx.EXPAND, 5)

        #add to main sizer
        # sizer.Add(sbox_sizer, 0, wx.ALL|wx.EXPAND, 2)
        sizer.Add(hsizer, 0, wx.ALL | wx.EXPAND, 5)
        sizer.Add(sbox_sizer3, 1, wx.ALL | wx.EXPAND, 5)
        sizer.Add(hsizer_controls, 0, wx.ALL | wx.EXPAND, 5)

        panel.SetSizer(sizer)

        w, h = sizer.Fit(self)

        try:
            self.SetIcon(theme.GetIcon("psu_png"))
        except:
            pass
    def __init__(self, parent, IDindividu=None):
        wx.Panel.__init__(self,
                          parent,
                          id=-1,
                          name="panel_identite",
                          style=wx.TAB_TRAVERSAL)
        self.parent = parent
        self.IDindividu = IDindividu

        self.majEffectuee = False

        # Identité
        self.staticbox_etatcivil_staticbox = wx.StaticBox(
            self, -1, _(u"Etat-civil"))
        self.label_civilite = wx.StaticText(self, -1, _(u"Civilité/genre :"))
        self.ctrl_civilite = CTRL_Saisie_civilite.Civilite(self)
        self.label_nomjfille = wx.StaticText(self, -1,
                                             _(u"Nom de jeune fille :"))
        self.ctrl_nomjfille = wx.TextCtrl(self, -1, u"")
        self.label_nom = wx.StaticText(self, -1, _(u"Nom :"))
        self.ctrl_nom = wx.TextCtrl(self, -1, "")
        self.label_prenom = wx.StaticText(self, -1, _(u"Prénom :"))
        self.ctrl_prenom = wx.TextCtrl(self, -1, "")
        self.label_numsecu = wx.StaticText(self, -1, _(u"Num. sécu. :"))
        self.ctrl_numsecu = CTRL_Saisie_numSecu.NumSecu(self)
        self.label_nationalite = wx.StaticText(self, -1, _(u"Nationalité :"))
        self.ctrl_nationalite = CTRL_Saisie_pays.SaisiePays(self,
                                                            mode="nationalite")

        # Naissance
        self.staticbox_naiss_staticbox = wx.StaticBox(self, -1,
                                                      _(u"Naissance"))
        self.label_datenaiss = wx.StaticText(self, -1, _(u"Date :"))
        self.ctrl_datenaiss = CTRL_Saisie_date.Date(self)
        self.ctrl_age = wx.TextCtrl(self,
                                    -1,
                                    "",
                                    style=wx.TE_CENTRE,
                                    size=(46, -1))
        self.label_paysnaiss = wx.StaticText(self, -1,
                                             _(u"Pays de naissance :"))
        self.ctrl_paysnaiss = CTRL_Saisie_pays.SaisiePays(self, mode="pays")
        self.label_lieunaiss = wx.StaticText(self, -1, _(u"Lieu | C.P. :"))
        self.ctrl_adressenaiss = CTRL_Saisie_adresse.Adresse(self)

        # Décès
        self.staticbox_deces = wx.StaticBox(self, -1, _(u"Décès"))
        self.ctrl_deces = wx.CheckBox(self, -1, u"")
        self.label_deces = wx.StaticText(self, -1, _(u"Année :"))
        self.ctrl_annee_deces = wx.TextCtrl(self, -1, u"")

        # Sieste
        self.staticbox_sieste = wx.StaticBox(self, -1, _(u"Sieste"))
        self.ctrl_sieste = Sieste(self)
        self.bouton_sieste = wx.Button(self, -1, "...", size=(20, 20))

        # Mémo
        self.staticbox_memo = wx.StaticBox(self, -1, _(u"Mémo"))
        self.ctrl_memo = wx.TextCtrl(self, -1, u"", style=wx.TE_MULTILINE)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_CHOICE, self.OnChoiceCivilite, self.ctrl_civilite)

        self.ctrl_nom.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocusNom)
        self.ctrl_prenom.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocusPrenom)
        self.ctrl_datenaiss.Bind(wx.EVT_TEXT, self.OnKillFocusDatenaiss)

        self.ctrl_nom.Bind(wx.EVT_TEXT, self.OnTextNomOuPrenom)
        self.ctrl_prenom.Bind(wx.EVT_TEXT, self.OnTextNomOuPrenom)

        self.ctrl_deces.Bind(wx.EVT_CHECKBOX, self.OnCheckDeces)

        self.Bind(wx.EVT_BUTTON, self.OnGestionSieste, self.bouton_sieste)

        self.OnCheckDeces(None)
        self.ctrl_nationalite.SetValue(IDpays=73)
        self.ctrl_paysnaiss.SetValue(IDpays=73)
示例#21
0
    def __init__(self, parent):  #, manipulador):
        'contructor requiere de parent como interfaz contenedor y manipulador como clase que accedera a la informacion'
        self.parent = parent
        wx.Panel.__init__(self, parent)  # Inicializacion Panel Padre
        self.SetBackgroundColour('3399FF')
        #self.father = manipulador

        # parametros basicos generales del registro de un examen
        self.conectordatabase = ConnectionDataBase.Connection(
            "localhost", "examen", "adminexamen", "pasexamen",
            "5434")  #se requerie de datos para conexion a motor
        self.conexion = ConnSchema.ConnSchema(self.conectordatabase)

        self.lblusuario = wx.StaticText(self, label="Usuario: ", pos=(100, 35))
        self.editusuario = wx.TextCtrl(self,
                                       value="",
                                       pos=(0, 35),
                                       size=(140, -1))
        self.lblcontra = wx.StaticText(self,
                                       label="Contraseña: ",
                                       pos=(100, 65))
        self.editcontra = wx.TextCtrl(self,
                                      value="",
                                      pos=(0, 35),
                                      size=(140, -1),
                                      style=wx.TE_PASSWORD)
        self.lbltipo = wx.StaticText(self,
                                     label="Tipo de Usuario: ",
                                     pos=(100, 65))
        self.sampleListTipo = []
        query = "SELECT * FROM tipopersona;"
        self.tipoescogido = ''  #se almacenara el identificador del tipo escogido
        self.opcionesRoles = self.conexion.connection.ExecuteQuery(
            query)  #consulta de todos los tipos de usuarios
        print("consutla sql de tipos de roles " + str(self.opcionesRoles))
        for a in self.opcionesRoles:
            self.sampleListTipo.append(a[1])
        self.edittipo = wx.ComboBox(self,
                                    choices=self.sampleListTipo,
                                    style=wx.CB_DROPDOWN)
        self.edittipo.Bind(wx.EVT_COMBOBOX, self.idtipoescogido)
        self.buttoningresar = wx.Button(self,
                                        wx.ID_OK,
                                        label="Ingresar",
                                        pos=(100, 65))
        self.buttonolvidar = wx.Button(self,
                                       wx.ID_OK,
                                       label="Olvidé la contraseña",
                                       pos=(0, 35))
        #como crear un boton agregando su evento

        self.buttoningresar.Bind(wx.EVT_BUTTON, self.ingresar)
        self.Bind(wx.EVT_BUTTON, self.olvidarcon, self.buttonolvidar)
        gs = wx.GridSizer(9, 2, 5, 5)  #Creacion grilla de tamaño
        #--------------Adición de Paneles a la Grilla, esta grilla permite que los paneles se ajuste al tamaño de la pantalla
        gs.AddMany([(self.lblusuario, 0, wx.ALIGN_CENTER),
                    (self.editusuario, 0, wx.ALIGN_CENTER),
                    (self.lblcontra, 0, wx.ALIGN_CENTER),
                    (self.editcontra, 0, wx.ALIGN_CENTER),
                    (self.lbltipo, 0, wx.ALIGN_CENTER),
                    (self.edittipo, 0, wx.ALIGN_CENTER),
                    (self.buttoningresar, 0, wx.ALIGN_CENTER),
                    (self.buttonolvidar, 0, wx.ALIGN_CENTER)])
        sizer = wx.BoxSizer(
            wx.VERTICAL)  #Adición de la grilla de tamaños al panel padre
        sizer.Add(gs, proportion=1, flag=wx.ALIGN_CENTER)
        self.SetSizer(sizer)
示例#22
0
    def graphics(self):
        # --- Parametres general
        self.learnFont = wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.NORMAL)

        # --- Box d'affichage
        # self.BoxLearn.screenOne=wx.StaticBox(self, pos=(18*self.Grid,16*self.Grid), size=(64*self.Grid,48*self.Grid))
        # self.BoxLearn.SetBackgroundColour("green")

        # --- Premiere ecrans - Demande lancement horloge
        self.path_circle = os.path.realpath('images/circle.png')
        self.img_circle = wx.Image(self.path_circle,wx.BITMAP_TYPE_PNG)
        self.bmp_circle = wx.BitmapFromImage(self.img_circle)
        self.pos_circle = ((self.WuwPanel.Width/2) - self.bmp_circle.Size[0]/2, (self.WuwPanel.Height/2) - self.bmp_circle.Size[1]/2)
        self.staticBmpCircle = wx.StaticBitmap(self.WuwPanel, wx.ID_ANY, self.bmp_circle, pos=self.pos_circle)

        self.screenOneChar = "Bienvenue dans l'apprentissage de SixthSense.\nPour lancer votre première application, reproduisez le cercle \ndevant vous à l'aide de votre doigt."
        self.screenOne_text = wx.StaticText(self.WuwPanel, -1, self.screenOneChar, pos=(self.WuwPanel.Width/2, self.WuwPanel.Height-5), style=wx.ALIGN_CENTRE, size=(self.WuwPanel.Width,self.WuwPanel.Height))
        self.screenOne_text.SetFont(self.learnFont)
        self.sTextOneSizer = self.screenOne_text.GetTextExtent(self.screenOneChar)
        self.screenOne_text.SetPosition(((self.WuwPanel.Width/2)-self.sTextOneSizer[0]/2, self.WuwPanel.Height-5-self.sTextOneSizer[1]))
        self.screenOne_text.SetForegroundColour(wx.Colour(255,255,255))
        
        self.staticBmpCircle.Hide()
        self.screenOne_text.Hide()

        # --- Deuxieme ecrans - Confirmation lancement horloge
        self.path_close = os.path.realpath('images/close.png')
        self.img_close = wx.Image(self.path_close, wx.BITMAP_TYPE_PNG)
        self.bmp_close = wx.BitmapFromImage(self.img_close)
        self.pos_close = ((self.WuwPanel.Width/2) - self.bmp_close.Size[0]/2, (self.WuwPanel.Height/1.4) - self.bmp_close.Size[1]/2)
        self.staticBmpClose = wx.StaticBitmap(self.WuwPanel, wx.ID_ANY, self.bmp_close, pos=self.pos_close)

        self.screenTwoChar = "Félicitations, vous venez de lancer votre première application.\nMaintenant, fermez-la en réalisant le geste de fermeture."
        self.screenTwo_text = wx.StaticText(self.WuwPanel, -1, self.screenTwoChar, pos=(self.WuwPanel.Width/2, self.WuwPanel.Height-5), style=wx.ALIGN_CENTRE, size=(self.WuwPanel.Width,self.WuwPanel.Height))
        self.screenTwo_text.SetFont(self.learnFont)
        self.sTextTwoSizer = self.screenTwo_text.GetTextExtent(self.screenTwoChar)
        self.screenTwo_text.SetPosition(((self.WuwPanel.Width/2)-self.sTextTwoSizer[0]/2, self.WuwPanel.Height-5-self.sTextTwoSizer[1]))
        self.screenTwo_text.SetForegroundColour(wx.Colour(255,255,255))

        self.staticBmpClose.Hide()
        self.screenTwo_text.Hide()

        # --- Troisieme ecrans - Demande lancement photo
        self.path_triangle = os.path.realpath('images/triangle.png')
        self.img_triangle = wx.Image(self.path_triangle,wx.BITMAP_TYPE_PNG)
        self.bmp_triangle = wx.BitmapFromImage(self.img_triangle)
        self.staticBmptriangle = wx.StaticBitmap(self.WuwPanel,wx.ID_ANY,self.bmp_triangle,pos=((self.WuwPanel.Width/2) - self.bmp_triangle.Size[0]/2, (self.WuwPanel.Height/2) - self.bmp_triangle.Size[1]/2))

        self.screenThreeChar = "Cette fois, prenez une photo en reproduissant cette forme."
        self.screenThree_text = wx.StaticText(self.WuwPanel, -1, self.screenThreeChar, pos=(self.WuwPanel.Width/2, self.WuwPanel.Height-5), style=wx.ALIGN_CENTRE, size=(self.WuwPanel.Width,self.WuwPanel.Height))
        self.screenThree_text.SetFont(self.learnFont)
        sTextThreeSizer = self.screenThree_text.GetTextExtent(self.screenThreeChar)
        self.screenThree_text.SetPosition(((self.WuwPanel.Width/2)-sTextThreeSizer[0]/2, self.WuwPanel.Height-5-sTextThreeSizer[1]))
        self.screenThree_text.SetForegroundColour(wx.Colour(255,255,255))
        
        self.staticBmptriangle.Hide()
        self.screenThree_text.Hide()

        # --- Quatrieme ecran - Fermeture de l'app photo
        self.screenFourChar = "Felicitations, vous venez de lancer votre seconde application.\nVous pouvez fermer l'application comme précédemment."
        self.screenFour_text = wx.StaticText(self.WuwPanel, -1, self.screenFourChar, pos=(self.WuwPanel.Width/2, self.WuwPanel.Height-5), style=wx.ALIGN_CENTRE, size=(self.WuwPanel.Width,self.WuwPanel.Height))
        self.screenFour_text.SetFont(self.learnFont)
        self.sTextFourSizer = self.screenFour_text.GetTextExtent(self.screenFourChar)
        self.screenFour_text.SetPosition(((self.WuwPanel.Width/2)-self.sTextFourSizer[0]/2, self.WuwPanel.Height-5-self.sTextFourSizer[1]))
        self.screenFour_text.SetForegroundColour(wx.Colour(255,255,255))
        
        self.screenFour_text.Hide()

        # --- Cinquième ecran - Fermeture de l'application Learn
        self.screenFiveChar = "L'apprentissage est maintenant terminé.\nVous pouvez fermer le tutoriel et commencer à utiliser SixthSense."
        self.screenFive_text = wx.StaticText(self.WuwPanel, -1, self.screenFiveChar, pos=(self.WuwPanel.Width/2, self.WuwPanel.Height-5), style=wx.ALIGN_CENTRE, size=(self.WuwPanel.Width,self.WuwPanel.Height))
        self.screenFive_text.SetFont(self.learnFont)
        self.sTextFiveSizer = self.screenFive_text.GetTextExtent(self.screenFiveChar)
        self.screenFive_text.SetPosition(((self.WuwPanel.Width/2)-self.sTextFiveSizer[0]/2, self.WuwPanel.Height-5-self.sTextFiveSizer[1]))
        self.screenFive_text.SetForegroundColour(wx.Colour(255,255,255))
        
        self.screenFive_text.Hide()
    def __init__(
        self, parent
    ):  #Parent aqui diz respeito a janela pai. Caso seja uma janela única, passaremos o valor None
        #Chama o superconstrutor da classe wx.Frame passando a informação da janela pai, título, posição, tamanho e estilo
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=u"Demonstração",
                          pos=wx.DefaultPosition,
                          size=wx.Size(500, 158),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)
        #Define os tamanho em que a janela não deve diminuir
        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
        #Cria um sizer do tipo BoxSizer com orientação vertical, empilhando os componentes
        bSizer1 = wx.BoxSizer(wx.VERTICAL)
        #Cria um Sizer do tipo Grid, com 2 colunas e quantidade de linhas automáticas. Informa também que não haverá espaçamento entre as células (0,0)
        gSizer2 = wx.GridSizer(0, 2, 0, 0)
        #cria um staticText com o rótulo Nome
        self.m_staticText9 = wx.StaticText(self, wx.ID_ANY, u"Nome:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText9.Wrap(-1)  #Libera para quebrar linha
        #Adiciona o texto estático no sizer, com proporção 0, com desenho das bordas com largura 5
        gSizer2.Add(self.m_staticText9, 0, wx.ALL, 5)
        #Cria um TextCtrl, com conteúodo vazio e proporção 0
        self.txtNome = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        #Adiciona o ctrlText (input) no sizer, com proporção 0, com desenho das bordas com largura 5
        gSizer2.Add(self.txtNome, 0, wx.ALL | wx.EXPAND, 5)

        #Adicionar o GridSizer ao BoxSizer, informando que pode expandir para ocupar o espaço disponível
        bSizer1.Add(gSizer2, 0, wx.EXPAND, 5)
        #A partir daqui segue procedimento semelhante ao comentando anteriormente.
        gSizer3 = wx.GridSizer(0, 2, 0, 0)

        self.m_staticText10 = wx.StaticText(self, wx.ID_ANY, u"E-mail",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText10.Wrap(-1)

        gSizer3.Add(self.m_staticText10, 0, wx.ALL, 5)

        self.txtEmail = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                    wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer3.Add(self.txtEmail, 0, wx.ALL | wx.EXPAND, 5)

        bSizer1.Add(gSizer3, 0, wx.EXPAND, 5)

        gSizer4 = wx.GridSizer(0, 4, 0, 0)

        self.buttonNovo = wx.Button(self, wx.ID_ANY, u"Novo",
                                    wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer4.Add(self.buttonNovo, 0, wx.ALL, 5)

        self.buttonSalvar = wx.Button(self, wx.ID_ANY, u"Salvar",
                                      wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer4.Add(self.buttonSalvar, 0, wx.ALL, 5)

        self.buttonExcluir = wx.Button(self, wx.ID_ANY, u"Excluir",
                                       wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer4.Add(self.buttonExcluir, 0, wx.ALL, 5)

        self.buttonSair = wx.Button(self, wx.ID_ANY, u"Sair",
                                    wx.DefaultPosition, wx.DefaultSize, 0)
        gSizer4.Add(self.buttonSair, 0, wx.ALL, 5)

        bSizer1.Add(gSizer4, 0, wx.EXPAND, 0)

        self.SetSizer(
            bSizer1
        )  #Define que o primeiro BoxSizer irá gerenciar o layout do Frame
        self.Layout()  #Aplica o Layout defino

        self.Centre(wx.BOTH)  #Centraliza a tela
示例#24
0
    def _populate(self):
        panel_sizer = wx.BoxSizer(wx.VERTICAL)

        top_sizer = wx.BoxSizer(wx.HORIZONTAL)
        top_sizer.Add((0, 0), 1, wx.EXPAND, 5)
        self.Text1 = wx.StaticText(self, wx.ID_ANY, "Static Text",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        top_sizer.Add(self.Text1, 0, wx.ALL, 10)
        top_sizer.Add((0, 0), 1, wx.EXPAND, 5)

        mid_sizer = wx.BoxSizer(wx.HORIZONTAL)
        mid_sizer.Add((0, 0), 1, wx.EXPAND, 5)

        hsizer2 = wx.BoxSizer()
        self.ledstack2 = []
        for i in range(2):
            colourstack = [wx.Colour(25, 225, 25, 200)] * 4
            colourstack.append(wx.Colour(225, 225, 25, 255))
            ledstuff = (wx.Bitmap(
                os.path.join(RESOURCES, 'led1rect_inactive_dark_basic2.png')),
                        wx.Bitmap(
                            os.path.join(RESOURCES,
                                         'led1rect_active_dark_basic2.png')))
            stack = LedArray(self, ledstuff, colourstack)
            stack.set_padding((15, 10))
            stack.spacing = 1
            stack.colour_shrink = 1
            stack.vertical = False
            stack.inverted = (i > 0)
            stack.value = 5
            hsizer2.Add(stack)
            self.ledstack2.append(stack)

        mid_sizer.Add(hsizer2)
        mid_sizer.Add((0, 0), 1, wx.EXPAND, 5)

        bot_sizer = wx.BoxSizer(wx.HORIZONTAL)
        bot_sizer.Add((0, 0), 1, wx.EXPAND, 5)

        hsizer3 = wx.BoxSizer()
        self.ledstack3 = []
        for i in range(2):
            colourstack = [wx.Colour(25, 35, 205, 200)] * 4
            colourstack.append(wx.Colour(25, 65, 255, 255))
            ledstuff = (wx.Bitmap(
                os.path.join(RESOURCES, 'led1rect_inactive_dark_basic2.png')),
                        wx.Bitmap(
                            os.path.join(RESOURCES,
                                         'led1rect_active_dark_basic2.png')))
            stack = LedArray(self, ledstuff, colourstack)
            stack.set_padding((15, 10))
            stack.spacing = 1
            stack.colour_shrink = 1
            stack.vertical = True
            stack.inverted = (i > 0)
            stack.value = 1
            stack.set_style(True)
            hsizer3.Add(stack)
            self.ledstack3.append(stack)

        bot_sizer.Add(hsizer3)
        bot_sizer.Add((0, 0), 1, wx.EXPAND, 5)

        panel_sizer.Add(top_sizer, 1, wx.EXPAND, 5)
        panel_sizer.Add(mid_sizer, 1, wx.EXPAND, 5)
        panel_sizer.Add(bot_sizer, 1, wx.EXPAND, 5)

        self.SetSizer(panel_sizer)
        self.Layout()
示例#25
0
 def __init__(self):
     wx.Frame.__init__(self, None, -1, "My Frame", size=(300, 300))
     panel = wx.Panel(self, -1)
     panel.Bind(wx.EVT_MOTION, self.OnMove)
     wx.StaticText(panel, -1, "Pos:", pos=(10, 12))
     self.posCtrl = wx.TextCtrl(panel, -1, "nada", pos=(40, 10))
    def _build_gui(self, frame, panel, vbox, argv, no_gui):

        def _form_set_freq(kv):
            return self.set_freq(kv['freq'])

        self.panel = panel

        # FIXME This REALLY needs to be replaced with a hand-crafted button
        # that sends both button down and button up events
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((10,0), 1)
        self.status_msg = wx.StaticText(panel, -1, "Press Space Bar to Transmit")
        of = self.status_msg.GetFont()
        self.status_msg.SetFont(wx.Font(15, of.GetFamily(), of.GetStyle(), of.GetWeight()))
        hbox.Add(self.status_msg, 0, wx.ALIGN_CENTER)
        hbox.Add((10,0), 1)
        vbox.Add(hbox, 0, wx.EXPAND | wx.ALIGN_CENTER)

        panel.Bind(wx.EVT_KEY_DOWN, self._on_key_down)
        panel.Bind(wx.EVT_KEY_UP, self._on_key_up)
        panel.Bind(wx.EVT_KILL_FOCUS, self._on_kill_focus)
        panel.SetFocus()

        if 1 and not(no_gui):
            rx_fft = fftsink2.fft_sink_c(panel, title="Rx Input", fft_size=512,
                                         sample_rate=self.rxpath.if_rate,
                                         ref_level=80, y_per_div=20)
            self.connect (self.rxpath.u, rx_fft)
            vbox.Add (rx_fft.win, 1, wx.EXPAND)

        if 1 and not(no_gui):
            rx_fft = fftsink2.fft_sink_c(panel, title="Post s/w Resampler",
                                         fft_size=512, sample_rate=self.rxpath.quad_rate,
                                         ref_level=80, y_per_div=20)
            self.connect (self.rxpath.resamp, rx_fft)
            vbox.Add (rx_fft.win, 1, wx.EXPAND)

        if 0 and not(no_gui):
            foo = scopesink2.scope_sink_f(panel, title="Squelch",
                                    	  sample_rate=32000)
            self.connect (self.rxpath.fmrx.div, (foo,0))
            self.connect (self.rxpath.fmrx.gate, (foo,1))
            self.connect (self.rxpath.fmrx.squelch_lpf, (foo,2))
            vbox.Add (foo.win, 1, wx.EXPAND)

        if 0 and not(no_gui):
            tx_fft = fftsink2.fft_sink_c(panel, title="Tx Output",
                                         fft_size=512, sample_rate=self.txpath.usrp_rate)
            self.connect (self.txpath.amp, tx_fft)
            vbox.Add (tx_fft.win, 1, wx.EXPAND)


        # add control area at the bottom

        self.myform = myform = form.form()

        # first row
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5,0), 0, 0)
        myform['freq'] = form.float_field(
            parent=panel, sizer=hbox, label="Freq", weight=1,
            callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg))

        hbox.Add((5,0), 0, 0)
        vbox.Add(hbox, 0, wx.EXPAND)


        # second row
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        myform['volume'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume",
                                        weight=3, range=self.rxpath.volume_range(),
                                        callback=self.set_volume)
        hbox.Add((5,0), 0)
        myform['squelch'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Squelch",
                                        weight=3, range=self.rxpath.squelch_range(),
                                        callback=self.set_squelch)

        g = self.rxpath.u.get_gain_range()
        hbox.Add((5,0), 0)
        myform['rx_gain'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Rx Gain",
                                        weight=3, range=(g.start(), g.stop(), g.step()),
                                        callback=self.set_rx_gain)
        hbox.Add((5,0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)


        self._build_subpanel(vbox)
示例#27
0
    def __init__(self, parent, index, offset):
        self.index = index
        self.offset = offset
        self.band1 = None
        self.band2 = None

        wx.Dialog.__init__(self, parent=parent, title="Scan Offset")

        figure = matplotlib.figure.Figure(facecolor='white')
        self.axes = figure.add_subplot(111)
        self.canvas = FigureCanvas(self, -1, figure)

        textHelp = wx.StaticText(
            self,
            label=
            "Remove the aerial and press refresh, adjust the offset so the shaded areas overlay the flattest parts of the plot."
        )

        textFreq = wx.StaticText(self, label="Test frequency (MHz)")
        self.spinFreq = wx.SpinCtrl(self)
        self.spinFreq.SetRange(F_MIN, F_MAX)
        self.spinFreq.SetValue(200)

        refresh = wx.Button(self, wx.ID_ANY, 'Refresh')
        self.Bind(wx.EVT_BUTTON, self.on_refresh, refresh)

        textOffset = wx.StaticText(self, label="Offset (kHz)")
        self.spinOffset = wx.SpinCtrl(self)
        self.spinOffset.SetRange(0, (SAMPLE_RATE - BANDWIDTH) / 1e3)
        self.spinOffset.SetValue(offset)
        self.Bind(wx.EVT_SPINCTRL, self.on_spin, self.spinOffset)

        sizerButtons = wx.StdDialogButtonSizer()
        buttonOk = wx.Button(self, wx.ID_OK)
        buttonCancel = wx.Button(self, wx.ID_CANCEL)
        sizerButtons.AddButton(buttonOk)
        sizerButtons.AddButton(buttonCancel)
        sizerButtons.Realize()
        self.Bind(wx.EVT_BUTTON, self.on_ok, buttonOk)

        boxSizer1 = wx.BoxSizer(wx.HORIZONTAL)
        boxSizer1.Add(textFreq, border=5)
        boxSizer1.Add(self.spinFreq, border=5)

        boxSizer2 = wx.BoxSizer(wx.HORIZONTAL)
        boxSizer2.Add(textOffset, border=5)
        boxSizer2.Add(self.spinOffset, border=5)

        gridSizer = wx.GridBagSizer(5, 5)
        gridSizer.Add(self.canvas,
                      pos=(0, 0),
                      span=(1, 2),
                      flag=wx.ALIGN_CENTER | wx.ALL)
        gridSizer.Add(textHelp,
                      pos=(1, 0),
                      span=(1, 2),
                      flag=wx.ALIGN_CENTER | wx.ALL)
        gridSizer.Add(boxSizer1,
                      pos=(2, 0),
                      span=(1, 2),
                      flag=wx.ALIGN_CENTER | wx.ALL)
        gridSizer.Add(refresh,
                      pos=(3, 0),
                      span=(1, 2),
                      flag=wx.ALIGN_CENTER | wx.ALL)
        gridSizer.Add(boxSizer2,
                      pos=(4, 0),
                      span=(1, 2),
                      flag=wx.ALIGN_CENTER | wx.ALL)
        gridSizer.Add(sizerButtons,
                      pos=(5, 1),
                      span=(1, 1),
                      flag=wx.ALIGN_RIGHT | wx.ALL)

        self.SetSizerAndFit(gridSizer)
        self.draw_limits()
示例#28
0
    def __init__(self, title):
        self.player = PitchPlayer()
        self.selected_tone = None

        wx.Frame.__init__(self,
                          None,
                          title=title,
                          pos=(150, 150),
                          size=(600, 850))
        self.Bind(wx.EVT_CLOSE, self.OnClose)

        menuBar = wx.MenuBar()
        menu = wx.Menu()
        m_exit = menu.Append(wx.ID_EXIT, "E&xit\tAlt-X",
                             "Close window and exit program.")
        self.Bind(wx.EVT_MENU, self.OnClose, m_exit)
        menuBar.Append(menu, "&File")
        menu = wx.Menu()
        self.SetMenuBar(menuBar)

        self.statusbar = self.CreateStatusBar()

        panel = wx.Panel(self)
        box = wx.BoxSizer(wx.VERTICAL)
        m_text = wx.StaticText(panel, -1, "Sone of a pitch")
        m_text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
        m_text.SetSize(m_text.GetBestSize())
        box.Add(m_text, 0, wx.ALL, 10)

        topp = wx.BoxSizer(wx.HORIZONTAL)
        topp.Add((10, -1))
        topp.Add(wx.StaticText(panel, -1, "A4 (Hz) = "))
        self.basepitch = wx.TextCtrl(panel, -1, "415", size=(175, -1))
        self.basepitch.Bind(wx.EVT_TEXT, self.textChange)
        topp.Add(self.basepitch)

        box.Add((-1, 10))
        box.Add(topp)

        topp = wx.BoxSizer(wx.HORIZONTAL)
        topp.Add((10, -1))
        self.sound_base = wx.CheckBox(panel, label='Play A sound too')
        self.sound_base.Bind(wx.EVT_CHECKBOX, self.onCheckBox)
        topp.Add(self.sound_base)
        box.Add(topp)

        box.Add((-1, 10))

        self.temperchoice = wx.RadioBox(panel,
                                        label='Temperament',
                                        choices=temperaments,
                                        majorDimension=1)
        self.temperchoice.Bind(wx.EVT_RADIOBOX, self.onRootChange)
        self.temperament = "quarter-comma meantone"
        box.Add(self.temperchoice)

        topp = wx.BoxSizer(wx.HORIZONTAL)
        topp.Add((10, -1))

        rootp = wx.BoxSizer(wx.VERTICAL)
        rootp.Add(wx.StaticText(panel, -1, "Root"))

        self.root_notes = []
        for i, pitch in enumerate(pitches):
            lbl = " %s " % pitch
            if i == 0:
                rb = wx.RadioButton(panel, i, label=lbl, style=wx.RB_GROUP)
            else:
                rb = wx.RadioButton(panel, i, label=lbl)
            rb.Bind(wx.EVT_RADIOBUTTON, self.onRootChange)
            rb.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
            self.root_notes.append(rb)
            #grid.Add( (15,-1) )
            rootp.Add(rb)

        topp.Add(rootp)
        topp.Add((20, -1))

        octp = wx.BoxSizer(wx.HORIZONTAL)
        octp.Add((10, -1))
        octp.Add(wx.StaticText(panel, -1, "Octave"))
        self.octcorr = wx.TextCtrl(panel, -1, "4", size=(50, -1))
        self.octcorr.Bind(wx.EVT_TEXT, self.textChange)
        octp.Add(self.octcorr)
        self.incrb = wx.Button(panel, wx.ID_ADD, "+", size=(25, -1))
        self.incrb.Bind(wx.EVT_BUTTON, self.onOctaveChange)
        self.decrb = wx.Button(panel, wx.ID_DELETE, "-", size=(25, -1))
        self.decrb.Bind(wx.EVT_BUTTON, self.onOctaveChange)
        octp.Add(self.decrb)
        octp.Add(self.incrb)
        topp.Add(octp)
        topp.Add((20, -1))

        grid = wx.GridSizer(12, 4, 10, 10)
        self.pitchnames = []
        self.freqrat = []
        self.centlabels = []
        self.hzs = []
        for i, pitch in enumerate(pitches):
            lbl = " %s " % pitch
            rb = wx.CheckBox(panel, i, label=lbl, size=(100, -1))
            #if i==0:
            #    rb = wx.RadioButton(panel,i, label =lbl,style = wx.RB_GROUP)
            #else:
            #    rb = wx.RadioButton(panel,i, label =lbl)
            rb.Bind(wx.EVT_CHECKBOX, self.onRadioGroup)
            rb.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
            #grid.Add( (15,-1) )
            self.pitchnames.append(rb)
            grid.Add(rb)
            rat = wx.StaticText(panel, -1, pitch)
            self.freqrat.append(rat)
            grid.Add(rat)

            rat = wx.StaticText(panel, -1, pitch)
            self.centlabels.append(rat)
            grid.Add(rat)

            rat = wx.StaticText(panel, -1, pitch)
            self.hzs.append(rat)
            grid.Add(rat)

        topp.Add(grid)
        box.Add(topp)

        butp = wx.BoxSizer(wx.HORIZONTAL)

        m_play = wx.Button(panel, wx.ID_CLOSE, "Play")
        m_play.Bind(wx.EVT_BUTTON, self.ClickPlay)
        butp.Add(m_play, 0, wx.ALL, 10)

        m_stop = wx.Button(panel, wx.ID_CLOSE, "Stop")
        m_stop.Bind(wx.EVT_BUTTON, self.StopPlay)
        butp.Add(m_stop, 0, wx.ALL, 10)

        m_close = wx.Button(panel, wx.ID_CLOSE, "Close")
        m_close.Bind(wx.EVT_BUTTON, self.OnClose)
        butp.Add(m_close, 0, wx.ALL, 10)
        box.Add(butp)

        panel.SetSizer(box)
        panel.Layout()
        self.update_from_root()
        self.update_freqrat()
示例#29
0
    def __init__(self, parent, main):
        self.main = main

        wx.Dialog.__init__(self, parent=parent, title="Plot Range")

        self.checkAuto = wx.CheckBox(self, wx.ID_ANY, "Auto Range")
        self.checkAuto.SetValue(self.main.settings.yAuto)
        self.Bind(wx.EVT_CHECKBOX, self.on_auto, self.checkAuto)

        textMax = wx.StaticText(self, label="Maximum (dB)")
        self.yMax = masked.NumCtrl(self,
                                   value=int(self.main.settings.yMax),
                                   fractionWidth=0,
                                   min=-100,
                                   max=20)
        textMin = wx.StaticText(self, label="Minimum (dB)")
        self.yMin = masked.NumCtrl(self,
                                   value=int(self.main.settings.yMin),
                                   fractionWidth=0,
                                   min=-100,
                                   max=20)
        self.set_enabled(not self.main.settings.yAuto)

        sizerButtons = wx.StdDialogButtonSizer()
        buttonOk = wx.Button(self, wx.ID_OK)
        buttonCancel = wx.Button(self, wx.ID_CANCEL)
        sizerButtons.AddButton(buttonOk)
        sizerButtons.AddButton(buttonCancel)
        sizerButtons.Realize()
        self.Bind(wx.EVT_BUTTON, self.on_ok, buttonOk)

        sizer = wx.GridBagSizer(10, 10)
        sizer.Add(self.checkAuto,
                  pos=(0, 0),
                  span=(1, 1),
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=10)
        sizer.Add(textMax,
                  pos=(1, 0),
                  span=(1, 1),
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=10)
        sizer.Add(self.yMax,
                  pos=(1, 1),
                  span=(1, 1),
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=10)
        sizer.Add(textMin,
                  pos=(2, 0),
                  span=(1, 1),
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=10)
        sizer.Add(self.yMin,
                  pos=(2, 1),
                  span=(1, 1),
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=10)
        sizer.Add(sizerButtons,
                  pos=(3, 0),
                  span=(1, 2),
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=10)

        self.SetSizerAndFit(sizer)
示例#30
0
 def create_widget(self):
     # up to 0.8 GenStaticText was used; it seems that nowadays StaticText handles mouse events on gtk as well
     #self.widget = wx.lib.stattext.GenStaticText(self.parent.widget, self.id, self.label)
     self.widget = wx.StaticText(self.parent.widget, self.id, self.label)
     if self.wrap:
         self.widget.Wrap(self.wrap)