Пример #1
0
    def __init__(self, parent, id, title, shortcut, isPrefix=False):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          title,
                          size=(800, 455 + Variables.windows_add_size))
        self.SetIcon(
            wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png",
                    wx.BITMAP_TYPE_ANY))
        self.SetTitle(
            _('{0} configuration').format(os.environ["APPLICATION_TITLE"]))

        self.windowSplitter = wx.SplitterWindow(self, -1, style=wx.SP_NOBORDER)

        self.panelEmpty = wx.Panel(self.windowSplitter, -1)
        self.onglets = ConfigureWindowNotebook(self.windowSplitter)

        self.noselect = wx.StaticText(
            self.panelEmpty,
            -1,
            _('Please select a program or a virtual drive to configure'),
            pos=(0, 150),
            style=wx.ALIGN_RIGHT)
        self.noselect.SetPosition(
            ((600 - self.noselect.GetSize()[0]) / 2, 150))

        self.noselect.Wrap(600)
        if (isPrefix == True):
            self.onglets.s_isPrefix = True
            self.onglets.s_prefix = shortcut
        else:
            self.onglets.s_isPrefix = False
            self.onglets.s_title = shortcut

        self.images = wx.ImageList(16, 16)

        self.leftPanel = wx.Panel(self.windowSplitter, -1)
        self.leftPanelSizer = wx.BoxSizer(wx.VERTICAL)
        self.leftPanel.SetSizer(self.leftPanelSizer)

        self.list_game = wx.TreeCtrl(self.leftPanel,
                                     900,
                                     size=wx.DefaultSize,
                                     style=wx.TR_HIDE_ROOT)
        self.leftPanelSizer.Add(self.list_game, 1, wx.EXPAND)

        self.prefixPanel = wx.Panel(self.leftPanel, -1)
        self.leftPanelSizer.Add(self.prefixPanel, 0, wx.EXPAND)

        if (os.environ["POL_OS"] == "Mac"):
            self.AddPrefix = wx.Button(self.prefixPanel,
                                       1001,
                                       _("New"),
                                       pos=(0, -8),
                                       size=(93, 30))
            self.DelPrefix = wx.Button(self.prefixPanel,
                                       1002,
                                       _("Remove"),
                                       pos=(98, -8),
                                       size=(93, 30))
        else:
            self.AddPrefix = wx.Button(self.prefixPanel,
                                       1001,
                                       _("New"),
                                       pos=(0, 0),
                                       size=(95, 25))
            self.DelPrefix = wx.Button(self.prefixPanel,
                                       1002,
                                       _("Remove"),
                                       pos=(100, 0),
                                       size=(95, 25))

        wx.EVT_BUTTON(self, 1001, self.NewPrefix)
        wx.EVT_BUTTON(self, 1002, self.DeletePrefix)

        self.list_game.SetSpacing(0)
        self.list_game.SetImageList(self.images)

        self.windowSplitter.SplitVertically(self.leftPanel, self.panelEmpty)
        self.windowSplitter.SetSashPosition(200)

        self.onglets.General(_("General"))
        self.onglets.Wine("Wine")
        self.onglets.Packages(_("Install components"))
        self.onglets.Display(_("Display"))
        self.onglets.Miscellaneous(_("Miscellaneous"))

        self.list_software()

        self.onglets.panelGeneral.Bind(wx.EVT_LEFT_UP,
                                       self.onglets.ReleaseTyping)
        wx.EVT_TREE_SEL_CHANGED(self, 900, self.change_program_to_selection)

        self.timer = wx.Timer(self, 1)
        self.Bind(wx.EVT_TIMER, self.AutoReload, self.timer)

        self.timer.Start(500)
        self.oldreload = None
        self.oldimg = None
        self.oldpref = None
        self.oldver32 = None
        self.olderver64 = None
        self.AutoReload(self)
Пример #2
0
    def __init__(self, parent, drug, model):
        wx.Panel.__init__(self,
                          parent=parent,
                          style=wx.NO_BORDER | wx.TAB_TRAVERSAL)

        self.form = Formulas()
        self.drugmodel = drug

        self.boxlabel = wx.StaticBoxSizer(
            wx.StaticBox(parent=self, label='Kinetic Parameters'), wx.VERTICAL)
        self.midsizer = wx.FlexGridSizer(4, 3, vgap=10)
        self.boxlabel.Add(self.midsizer)

        self.SetSizer(self.boxlabel)

        #create some widgets for the midpanel
        self.sexlabel = wx.StaticText(parent=self, label='Sex: ')
        self.sexinputmale = wx.RadioButton(parent=self,
                                           label='Male',
                                           style=wx.RB_GROUP)
        self.sexinputfemale = wx.RadioButton(parent=self, label='Female')

        self.agelabel = wx.StaticText(self, label='Age: ')
        self.ageinput = wx.SpinCtrl(parent=self,
                                    size=(50, -1),
                                    style=wx.SP_WRAP | wx.SP_ARROW_KEYS)
        self.ageinput.SetRange(0, 400)
        self.ageinput.SetValue(65)

        self.weightlabel = wx.StaticText(parent=self, label='Weight: ')
        self.weightinput = wx.SpinCtrl(parent=self,
                                       size=(50, -1),
                                       style=wx.SP_WRAP | wx.SP_ARROW_KEYS)
        self.weightinput.SetRange(10, 800)
        self.weightinput.SetValue(155)
        self.weightunits = wx.ComboBox(parent=self,
                                       choices=(['Pounds', 'Kilograms']),
                                       style=wx.CB_READONLY)
        self.weightunits.SetValue('Kilograms')

        self.heightlabel = wx.StaticText(parent=self, label='Height: ')
        self.heightinput = wx.SpinCtrl(parent=self,
                                       size=(50, -1),
                                       style=wx.SP_WRAP | wx.SP_ARROW_KEYS)
        self.heightinput.SetRange(0, 500)
        self.heightinput.SetValue(65)
        self.heightunits = wx.ComboBox(parent=self,
                                       choices=(['Inches', 'Centimeters']),
                                       style=wx.CB_READONLY)
        self.heightunits.SetValue('Inches')

        self.scrlabel = wx.StaticText(parent=self, label='Serum Creatinine: ')
        self.scrinput = FloatSpin(parent=self,
                                  value=1.1,
                                  min_val=0,
                                  max_val=10,
                                  increment=0.1,
                                  digits=1,
                                  size=(50, -1))
        self.scrunitslabel = wx.StaticText(parent=self, label=' mg/dL')

        #IBW widgets
        self.IdealBodyWeightlabel = wx.StaticText(parent=self,
                                                  label='Ideal Weight: ')
        self.IdealBodyWeightoutput = wx.StaticText(
            parent=self,
            label=str(
                self.form.IdealBodyWeight(self.getsex(), self.getheight())))
        self.IdealBodyWeightunits = wx.StaticText(parent=self,
                                                  label='Kilograms')

        #CrCl Label updated
        self.crcllabel = wx.StaticText(parent=self, label='CrCl: ')
        self.crcloutput = wx.StaticText(parent=self,
                                        label=str(
                                            self.form.CrofGaul(
                                                self.getsex(), self.getage(),
                                                self.getCrClWeight(),
                                                self.getscr())))
        self.crclunits = wx.StaticText(parent=self, label=' ml/min')

        #Create VD label and value
        self.VDlabel = wx.StaticText(
            self, label='Estimated Volume of Distribution: ')
        self.VDoutput = wx.StaticText(self, label=str(round(self.getvd(), 1)))
        self.VDunits = wx.StaticText(self, label='Liters')

        #create K label and value
        self.klabel = wx.StaticText(self,
                                    label='Estimated Rate Constant (k): ')
        self.koutput = wx.StaticText(self, label=str(round(self.getk(), 5)))
        self.kunits = wx.StaticText(self, label=' /hour')

        #create half life label and value
        self.thalflabel = wx.StaticText(self, label='Estimated Half-Life: ')
        self.thalfoutput = wx.StaticText(self,
                                         label=str(round(self.getthalf(), 1)))
        self.thalfunits = wx.StaticText(self, label=' hours')

        #place widgets into the sizer
        self.dummypanel = wx.Panel(parent=self)
        self.dummypanel1 = wx.Panel(parent=self)
        self.dummypanel2 = wx.Panel(parent=self)
        self.dummypanel3 = wx.Panel(parent=self)
        self.midsizer.AddMany([
            (self.sexlabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            self.sexinputmale, self.sexinputfemale,
            (self.agelabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            self.ageinput, self.dummypanel1,
            (self.weightlabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            self.weightinput, self.weightunits,
            (self.IdealBodyWeightlabel, -1,
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.IdealBodyWeightoutput, -1, wx.ALIGN_CENTER),
            (self.IdealBodyWeightunits, -1, wx.ALIGN_CENTER_VERTICAL),
            (self.heightlabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            self.heightinput, self.heightunits,
            (self.scrlabel, -1,
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT), self.scrinput,
            (self.scrunitslabel, -1, wx.ALIGN_CENTER_VERTICAL),
            (self.crcllabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.crcloutput, -1, wx.ALIGN_CENTER),
            (self.crclunits, -1, wx.ALIGN_CENTER_VERTICAL),
            (self.VDlabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.VDoutput, -1, wx.ALIGN_CENTER),
            (self.VDunits, -1, wx.ALIGN_CENTER_VERTICAL),
            (self.klabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.koutput, -1, wx.ALIGN_CENTER),
            (self.kunits, -1, wx.ALIGN_CENTER_VERTICAL),
            (self.thalflabel, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.thalfoutput, -1, wx.ALIGN_CENTER),
            (self.thalfunits, -1, wx.ALIGN_CENTER_VERTICAL)
        ])
Пример #3
0
    def __init__(self, parent, VD, ke):
        wx.Panel.__init__(self, parent=parent, style=wx.NO_BORDER)

        self.form = Formulas()
        self.vd = VD
        self.k = ke

        self.boxlabel = wx.StaticBoxSizer(
            wx.StaticBox(parent=self, label='Patient Specific Dosing'))
        self.midsizer = wx.GridBagSizer(10, 10)
        self.boxlabel.Add(self.midsizer)

        self.SetSizer(self.boxlabel)

        #create widgets
        self.firstlevellabel = wx.StaticText(self,
                                             label='Measured Peak Level: ')
        self.firstlevelinput = FloatSpin(parent=self,
                                         value=28.9,
                                         min_val=0,
                                         max_val=60,
                                         increment=0.1,
                                         digits=1,
                                         size=(75, -1))
        self.firstlevelunits = wx.StaticText(self, label=' mcg/ml')

        self.firsttimefromdoselabel = wx.StaticText(
            self, label='Time from end of infusion: ')
        self.firsttimefromdoseinput = FloatSpin(parent=self,
                                                value=2.4,
                                                min_val=0,
                                                max_val=60,
                                                increment=0.1,
                                                digits=1,
                                                size=(75, -1))
        self.firsttimefromdoseunits = wx.StaticText(self, label=' hours')

        self.secondlevellabel = wx.StaticText(self,
                                              label='Measured Trough Level: ')
        self.secondlevelinput = FloatSpin(parent=self,
                                          value=7.0,
                                          min_val=0,
                                          max_val=60,
                                          increment=0.1,
                                          digits=1,
                                          size=(75, -1))
        self.secondlevelunits = wx.StaticText(self, label=' mcg/ml')

        self.secondtimefromdoselabel = wx.StaticText(
            self, label='Time until next infusion: ')
        self.secondtimefromdoseinput = FloatSpin(parent=self,
                                                 value=2.4,
                                                 min_val=0,
                                                 max_val=60,
                                                 increment=0.1,
                                                 digits=1,
                                                 size=(75, -1))
        self.secondtimefromdoseunits = wx.StaticText(self, label=' hours')

        self.timebetweenlabel = wx.StaticText(
            self, label='Time Elapsed Between Levels: ')
        self.timebetweeninput = FloatSpin(parent=self,
                                          value=17.1,
                                          min_val=0,
                                          max_val=100,
                                          increment=0.1,
                                          digits=1,
                                          size=(75, -1))
        self.timebetweenunits = wx.StaticText(self, label=' hours')

        self.infutimelabel = wx.StaticText(self, label='Infusion Time: ')
        self.infutimeinput = wx.SpinCtrl(parent=self,
                                         size=(50, -1),
                                         style=wx.SP_WRAP | wx.SP_ARROW_KEYS)
        self.infutimeunits = wx.StaticText(self, label=' hours')
        self.infutimeinput.SetRange(1, 5)
        self.infutimeinput.SetValue(2)

        self.dtaulabel = wx.StaticText(self, label='Interval of Doses: ')
        self.dtauinput = wx.SpinCtrl(parent=self,
                                     size=(50, -1),
                                     style=wx.SP_WRAP | wx.SP_ARROW_KEYS)
        self.dtauunits = wx.StaticText(self, label=' hours')
        self.dtauinput.SetRange(0, 50)
        self.dtauinput.SetValue(24)

        self.cmaxlabel = wx.StaticText(self, label='Desired Cmax: ')
        self.cmaxinput = wx.SpinCtrl(parent=self,
                                     size=(50, -1),
                                     style=wx.SP_WRAP | wx.SP_ARROW_KEYS)
        self.cmaxunits = wx.StaticText(self, label=' mg/L')
        self.cmaxinput.SetRange(0, 50)
        self.cmaxinput.SetValue(30)

        self.cminlabel = wx.StaticText(self, label='Desired Trough: ')
        self.cmininput = wx.SpinCtrl(parent=self,
                                     size=(50, -1),
                                     style=wx.SP_WRAP | wx.SP_ARROW_KEYS)
        self.cminunits = wx.StaticText(self, label=' mg/L')
        self.cmininput.SetRange(0, 50)
        self.cmininput.SetValue(10)

        self.klabel = wx.StaticText(self,
                                    label='Calculated Rate Constant (k): ')
        self.koutput = wx.StaticText(self, label=str(round(self.getk(), 5)))
        self.kunits = wx.StaticText(self, label=' /hour')

        #setup graphing area
        self.plotpanel = wx.Panel(self)
        self.plotsizer = wx.BoxSizer(wx.VERTICAL)
        self.plotpanel.SetSizer(self.plotsizer)

        self.plotter = PlotCanvas(self.plotpanel)
        self.plotter.SetInitialSize(size=(700, 550))
        self.plotter.SetEnableGrid(True)
        #self.plotter.SetEnableLegend(True)
        #self.plotter.SetEnablePointLabel(True)
        #self.plotter.setLogScale((False,True))

        self.logline = [(0, self.getextratrough()),
                        (self.infutimeinput.GetValue(), self.getextrapeak())]
        self.timechange = 0
        self.data = [(0, 0), (2, 3), (3, 5), (4, 6), (5, 8)]

        self.line = PolyLine(self.logline, colour='blue', width=3)
        #self.line.setLogScale((False,True))
        self.marker = PolyMarker(self.data, marker='triangle')
        self.gc = PlotGraphics([self.line, self.marker], 'Drug Levels',
                               'Hours', 'mcg/ml')

        self.plotsizer.Add(self.plotter)

        #add widgets to the sizer
        self.dummypanel = wx.Panel(parent=self)
        self.dummypanel1 = wx.Panel(parent=self)
        self.dummypanel2 = wx.Panel(parent=self)
        self.dummypanel3 = wx.Panel(parent=self)
        self.midsizer.AddMany([
            (self.firstlevellabel, (0, 0), (1, 1),
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.firstlevelinput, (0, 1), (1, 1), wx.ALIGN_CENTER),
            (self.firstlevelunits, (0, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL),
            (self.firsttimefromdoselabel, (1, 0), (1, 1),
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.firsttimefromdoseinput, (1, 1), (1, 1), wx.ALIGN_CENTER),
            (self.firsttimefromdoseunits, (1, 2), (1, 1),
             wx.ALIGN_CENTER_VERTICAL),
            (self.secondlevellabel, (2, 0), (1, 1),
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.secondlevelinput, (2, 1), (1, 1), wx.ALIGN_CENTER),
            (self.secondlevelunits, (2, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL),
            (self.secondtimefromdoselabel, (3, 0), (1, 1),
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.secondtimefromdoseinput, (3, 1), (1, 1), wx.ALIGN_CENTER),
            (self.secondtimefromdoseunits, (3, 2), (1, 1),
             wx.ALIGN_CENTER_VERTICAL),
            (self.timebetweenlabel, (4, 0), (1, 1),
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.timebetweeninput, (4, 1), (1, 1), wx.ALIGN_CENTER),
            (self.timebetweenunits, (4, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL),
            (self.infutimelabel, (5, 0), (1, 1),
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.infutimeinput, (5, 1), (1, 1), wx.ALIGN_CENTER),
            (self.infutimeunits, (5, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL),
            (self.dtaulabel, (6, 0), (1, 1),
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.dtauinput, (6, 1), (1, 1), wx.ALIGN_CENTER),
            (self.dtauunits, (6, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL),
            (self.cmaxlabel, (7, 0), (1, 1),
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.cmaxinput, (7, 1), (1, 1), wx.ALIGN_CENTER),
            (self.cmaxunits, (7, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL),
            (self.cminlabel, (8, 0), (1, 1),
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.cmininput, (8, 1), (1, 1), wx.ALIGN_CENTER),
            (self.cminunits, (8, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL),
            (self.klabel, (9, 0), (1, 1),
             wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
            (self.koutput, (9, 1), (1, 1), wx.ALIGN_CENTER),
            (self.kunits, (9, 2), (1, 1), wx.ALIGN_CENTER_VERTICAL),
            (self.plotpanel, (0, 4), (11, 11), wx.ALIGN_CENTER)
        ])

        self.reloading(wx.EVT_SPINCTRL)
Пример #4
0
def create_plot(parent, editor):
    """ Creates a data explorer plot.
    """
    try:
        nmep = editor.object
        model = nmep.model
        items = nmep.plot_items
        if len(items) == 0:
            return wx.Panel(parent, -1)
        index = nmep.plot_index
        if index is None:
            plot_index = PlotValue(arange(0.0, len(model.model_indices)))
            selection_index = None
        else:
            plot_index = PlotValue(ModelData(model=model, name=index.name))
            selection_index = PlotValue(
                SelectionData(model=model, name=index.name))
        canvas = PlotCanvas(plot_type=items[0].plot_type,
                            plot_bg_color=items[0].canvas_color)
        canvas.axis_index = PlotAxis()
        if index is not None:
            canvas.axis_index.title = index.label
        if len(items) == 1:
            canvas.axis = PlotAxis(title=items[0].label)
        else:
            canvas.add(
                PlotGroup(overlay=True,
                          position='top right',
                          *[
                              PlotOverlay(legend_color=item.line_color,
                                          text=item.label,
                                          border_size=0,
                                          bg_color=transparent,
                                          margin=0,
                                          padding=2) for item in items
                          ]))
        for item in items:
            canvas.add(
                PlotValue(ModelData(model=model).set(name=item.name),
                          index=plot_index,
                          plot_type=item.plot_type,
                          line_weight=item.line_weight,
                          line_color=item.line_color,
                          fill_color=item.fill_color,
                          outline_color=item.outline_color,
                          size='small'))
            if selection_index is not None:
                plot_value = PlotValue(
                    SelectionData(model=model).set(name=item.name),
                    index=selection_index,
                    plot_type='scatter',
                    size=item.selection_size,
                    fill_color=item.selection_color)
                canvas.add(plot_value)

        # Set up the interactive data filters:
        if selection_index is not None:
            canvas.interaction = nmep._interaction = ia = \
                NumericModelExplorerInteraction( value = plot_value )
            nmep._selection_models = sms = []
            ia._filters = filters = []
            for item in items:
                sm = model.get_selection_model()
                sms.append(sm)
                sm.model_filter = PolygonFilter(x_value=index.name,
                                                y_value=item.name)
                filters.append(sm.model_filter)

            ia.on_trait_change(editor.ui.handler.interaction_complete,
                               'points')
            if len(nmep.polygon) > 0:
                do_later(ia.set_selection, nmep.polygon)

        return Window(parent,
                      component=PlotComponent(component=canvas)).control
    except:
        import traceback
        traceback.print_exc()
        raise
Пример #5
0
    def __init__(self, parent):

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

        self.resetValue = None
        self.parent = parent
        panel = wx.Panel(self)
        sizer = wx.BoxSizer(wx.VERTICAL)

        sbox = wx.StaticBox(panel, label="")
        sboxSizer = wx.StaticBoxSizer(sbox, wx.VERTICAL)

        gridListBoxes = wx.GridBagSizer(2, 1)
        sboxSizer.Add(gridListBoxes, 1, wx.ALL | wx.EXPAND, 5)
        row = 0
        for n, name in enumerate(["browser", "url"]):
            hSizerBtns = wx.BoxSizer(wx.HORIZONTAL)
            labels = ["add", "up", "down", "edit", "delete"]
            if name == "browser":
                labels.append("open")
            for label in labels:
                img = wx.Image("icons/{0}.png".format(label.lower().replace(
                    " ", "")))
                img = img.Rescale(32, 32, wx.IMAGE_QUALITY_HIGH)
                bmp = wx.Bitmap(img)
                btn = wx.Button(panel,
                                label=label,
                                name=name,
                                style=wx.BU_EXACTFIT | wx.BU_NOTEXT)
                btn.Bind(wx.EVT_BUTTON, self.OnButton)
                btn.SetBitmap(bmp)
                hSizerBtns.Add(btn, 0, wx.ALL | wx.EXPAND, 5)
            gridListBoxes.Add(hSizerBtns,
                              pos=(row, n),
                              flag=wx.ALL | wx.EXPAND,
                              border=5)

        row += 1
        self.browserList = base.BaseList(panel)
        self.browserList.SetSingleStyle(wx.LC_EDIT_LABELS)
        self.browserList.SetSingleStyle(wx.LC_SINGLE_SEL, add=False)
        self.browserList.Bind(wx.EVT_LIST_ITEM_ACTIVATED,
                              self.OnListItemActivated)
        self.browserList.InsertColumn(0, "Browsers")
        gridListBoxes.Add(self.browserList,
                          pos=(row, 0),
                          flag=wx.ALL | wx.EXPAND,
                          border=5)

        self.urlPresetList = base.BaseList(panel)
        self.urlPresetList.SetSingleStyle(wx.LC_EDIT_LABELS)
        self.urlPresetList.SetSingleStyle(wx.LC_SINGLE_SEL, add=False)
        self.urlPresetList.Bind(wx.EVT_LIST_ITEM_ACTIVATED,
                                self.OnListItemActivated)
        self.urlPresetList.InsertColumn(0, "URLs")
        gridListBoxes.Add(self.urlPresetList,
                          pos=(row, 1),
                          flag=wx.ALL | wx.EXPAND,
                          border=5)
        gridListBoxes.AddGrowableRow(1)
        gridListBoxes.AddGrowableCol(0)
        gridListBoxes.AddGrowableCol(1)

        row += 1
        for n, label in enumerate(["Set Browser Path", "Set URL Path"]):
            btn = wx.Button(panel, label=label)
            btn.Bind(wx.EVT_BUTTON, self.OnButton)
            gridListBoxes.Add(btn,
                              pos=(row, n),
                              flag=wx.ALL | wx.ALIGN_RIGHT,
                              border=5)

        grid = wx.GridBagSizer(5, 5)
        row = 0
        lbl = wx.StaticText(panel, label="Browser Path:")
        self.textBrowser = wx.TextCtrl(panel)
        btnAdd = wx.Button(panel, label="Add To Browsers")
        btnAdd.Bind(wx.EVT_BUTTON, self.OnButton)
        self.chkNewWin = wx.CheckBox(panel, label="New Window")
        self.chkAutoraise = wx.CheckBox(panel, label="Autoraise")
        self.chkAutoraise.SetValue(1)
        grid.Add(lbl, pos=(row, 0), flag=wx.ALL | wx.ALIGN_CENTRE, border=5)
        grid.Add(self.textBrowser,
                 pos=(row, 1),
                 flag=wx.ALL | wx.EXPAND,
                 border=5)
        grid.Add(btnAdd, pos=(row, 2), flag=wx.ALL | wx.EXPAND, border=5)
        grid.Add(self.chkNewWin,
                 pos=(row, 3),
                 flag=wx.ALL | wx.EXPAND,
                 border=5)
        grid.Add(self.chkAutoraise,
                 pos=(row, 4),
                 flag=wx.ALL | wx.EXPAND,
                 border=5)

        row += 1
        lbl = wx.StaticText(panel, label="Browser Type:")
        browsers = [b for b in advwebbrowser.klasses.keys()]
        self.cboxBrowserClass = wx.ComboBox(panel,
                                            choices=browsers,
                                            style=wx.CB_READONLY)
        self.cboxBrowserClass.Select(0)
        grid.Add(lbl, pos=(row, 0), flag=wx.ALL | wx.ALIGN_CENTRE, border=5)
        grid.Add(self.cboxBrowserClass,
                 pos=(row, 1),
                 flag=wx.ALL | wx.EXPAND,
                 border=5)

        row += 1
        lblCmd = wx.StaticText(panel, label="URL:")
        self.textUrl = wx.TextCtrl(panel)
        btnAdd = wx.Button(panel, label="Add To URL")
        btnAdd.Bind(wx.EVT_BUTTON, self.OnButton)
        btnReset = wx.Button(panel, label="Reset")
        btnReset.Bind(wx.EVT_BUTTON, self.OnButton)
        btnClear = wx.Button(panel, label="Clear")
        btnClear.Bind(wx.EVT_BUTTON, self.OnButton)

        grid.Add(lblCmd, pos=(row, 0), flag=wx.ALL | wx.ALIGN_CENTRE, border=5)
        grid.Add(self.textUrl, pos=(row, 1), flag=wx.ALL | wx.EXPAND, border=5)
        grid.Add(btnAdd, pos=(row, 2), flag=wx.ALL | wx.EXPAND, border=5)
        grid.Add(btnReset, pos=(row, 3), flag=wx.ALL | wx.EXPAND, border=5)
        grid.Add(btnClear, pos=(row, 4), flag=wx.ALL, border=5)

        grid.AddGrowableCol(1)

        sboxSizer.AddSpacer(10)
        sboxSizer.Add(grid, 0, wx.ALL | wx.EXPAND, 2)
        #-----
        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.AddStretchSpacer()
        btnCancel = wx.Button(panel, label="Cancel", id=wx.ID_CANCEL)
        btnCancel.Bind(wx.EVT_BUTTON, self.OnButton)
        self.btnAdd = wx.Button(panel, label="Ok", id=wx.ID_OK)
        self.btnAdd.Bind(wx.EVT_BUTTON, self.OnButton)
        # self.btnAdd.Disable()
        hsizer.Add(btnCancel, 0, wx.ALL | wx.EXPAND, 5)
        hsizer.Add(self.btnAdd, 0, wx.ALL | wx.EXPAND, 5)

        #add to main sizer
        sizer.Add(sboxSizer, 1, wx.ALL | wx.EXPAND, 5)
        sizer.Add(hsizer, 0, wx.ALL | wx.EXPAND, 5)

        panel.SetSizer(sizer)

        w, h = sizer.Fit(self)
        self.SetMinSize((w * 2, h * 1.5))
        self.SetSize((w * 2, h * 1.5))

        try:
            icon = wx.Icon("images/openurl.png")
            self.SetIcon(icon)
        except Exception as e:
            print(e)
    def MyPanel2(self):
        #wx.Panel.MyPanel2 ( self, id = -1, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )
        self.panelNum = 3
        self.mypanel2_panel = wx.Panel(self, pos=(0, 0), size=(500, 400))
        font1 = wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.LIGHT)
        font2 = wx.Font(16, wx.ROMAN, wx.ITALIC, wx.LIGHT)
        font3 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.LIGHT)

        bSizer3 = wx.BoxSizer(wx.VERTICAL)

        self.panel2_la = wx.StaticText(self,
                                       wx.ID_ANY,
                                       u"  Please choose the picture",
                                       pos=(100, 100),
                                       size=(50, 50))
        self.panel2_la.SetFont(font2)
        self.panel2_la.SetForegroundColour("#F7F7F7")
        bSizer3.Add(self.panel2_la, 0, wx.ALL | wx.EXPAND, 5)

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

        self.docu_la = wx.StaticText(self,
                                     wx.ID_ANY,
                                     u"   请选择图片文件:",
                                     pos=(0, 0),
                                     size=(250, 100))
        self.docu_la.SetFont(font3)
        self.docu_la.SetForegroundColour("#F7F7F7")
        self.docu_la.Wrap(-1)
        gSizer3.Add(self.docu_la, 0, wx.ALL, 5)

        m_comboBox1Choices = [
            u"2px_黑体", u"2px_宋体", u"醉翁亭记", u"小石潭记", u"放鹤亭记", u"石钟山记", u"口技",
            u"前赤壁赋", u"岳阳楼记", u"核舟记"
        ]

        self.m_comboBox1 = wx.ComboBox(self, -1, u"请选择文件", wx.DefaultPosition,
                                       wx.DefaultSize, m_comboBox1Choices, 0)
        gSizer3.Add(self.m_comboBox1, 0, wx.ALL, 5)

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

        self.in_la = wx.StaticText(self,
                                   -1,
                                   u"  请输入嵌入信息",
                                   pos=(100, 100),
                                   size=(300, 20))
        self.in_la.Wrap(-1)
        bSizer3.Add(self.in_la, 0, wx.ALL, 5)

        self.en_txt = wx.TextCtrl(self,
                                  -1,
                                  wx.EmptyString,
                                  pos=(100, 100),
                                  size=(350, 130),
                                  style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER)
        bSizer3.Add(self.en_txt, 1, wx.EXPAND | wx.ALL, 5)

        gSizer4 = wx.GridSizer(1, 2, 0, 0)

        self.button3 = wx.Button(self, -1, u"<-返回", wx.DefaultPosition,
                                 wx.DefaultSize, 0)
        gSizer4.Add(self.button3, 0, wx.ALL | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT,
                    5)

        self.button4 = wx.Button(self, -1, u"确定", wx.DefaultPosition,
                                 wx.DefaultSize, 0)
        gSizer4.Add(self.button4, 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT | wx.ALL,
                    5)

        bSizer3.Add(gSizer4, 1, wx.EXPAND, 5)

        self.SetSizer(bSizer3)
        self.Layout()
        self.m_comboBox1.Bind(wx.EVT_COMBOBOX, self.OnCombo)
        self.en_txt.Bind(wx.EVT_TEXT, self.input_info)
        self.button3.Bind(wx.EVT_BUTTON, self.back_click)
        self.button4.Bind(wx.EVT_BUTTON, self.click_next2)

        #self.bro = wx.StaticText( self.mypanel2_panel, -1, u"浏览文件夹", pos=(100,100), size=(100,30),style = wx.TE_MULTILINE)
        #self.btn_bro = wx.Button(self.mypanel2_panel,label = "Open a File")
        #self.btn_bro.SetForegroundColour("#F7F7F7")
        #self.btn_bro.SetFont(font2)
        #gSizer3.Add(self.btn_bro,0,wx.ALL,5)

        #绑定事件
        self.mypanel2_panel.Bind(wx.EVT_ERASE_BACKGROUND,
                                 self.login_background)
    def login_pa(self):

        #wx.Frame.login_la ( self, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 400,400 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        self.login_panel = wx.Panel(self, pos=(0, 0), size=(500, 400))
        #self.panelNum = 2
        font = wx.Font(14, wx.SCRIPT, wx.NORMAL, wx.NORMAL, False)

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

        bSizer1 = wx.BoxSizer(wx.VERTICAL)

        self.line1_la = wx.StaticLine(self.login_panel, -1, wx.DefaultPosition,
                                      wx.DefaultSize, wx.LI_HORIZONTAL)
        bSizer1.Add(self.line1_la, 0, wx.EXPAND | wx.ALL, 5)

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

        self.ac_la = wx.StaticText(self.login_panel, -1, u"用户名",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        self.ac_la.Wrap(-1)

        gSizer1.Add(self.ac_la, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 35)

        self.ac_txt = wx.TextCtrl(self.login_panel,
                                  -1,
                                  "",
                                  pos=(0, 0),
                                  size=(200, 25),
                                  style=wx.TE_NOHIDESEL)
        self.ac_txt.SetForegroundColour('gray')
        self.ac_txt.SetFont(font)
        gSizer1.Add(self.ac_txt, 0, wx.TOP | wx.BOTTOM | wx.RIGHT, 35)

        self.pw_la = wx.StaticText(self.login_panel, -1, u"密码",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        self.pw_la.Wrap(-1)
        gSizer1.Add(self.pw_la, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 35)

        self.pw_txt = wx.TextCtrl(self.login_panel,
                                  -1,
                                  '',
                                  pos=(0, 0),
                                  size=(200, 25),
                                  style=wx.TE_PASSWORD)
        self.pw_txt.SetForegroundColour('gray')
        content = self.pw_txt.GetValue()
        gSizer1.Add(self.pw_txt, 0, wx.TOP | wx.BOTTOM | wx.RIGHT, 35)

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

        self.button1 = wx.Button(self.login_panel, -1, u"确定",
                                 wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.button1, 1, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
        self.button1.Bind(wx.EVT_BUTTON, self.click_next)

        self.SetSizer(bSizer1)
        self.Layout()

        self.Centre(wx.BOTH)

        #绑定事件
        #if (content == '123456'):
        self.login_panel.Bind(wx.EVT_ERASE_BACKGROUND, self.login_background)
Пример #8
0
    def basicGUI(self):

        panel = wx.Panel(self)

        menuBar = wx.MenuBar()

        fileButton = wx.Menu()
        editButton = wx.Menu()

        exitItem = fileButton.Append(wx.ID_EXIT, 'Check', 'checking files...')
        menuBar.Append(fileButton, 'File')
        menuBar.Append(editButton, 'Edit')

        self.SetMenuBar(menuBar)
        self.Bind(wx.EVT_MENU, self.Quit, exitItem)

        nameBox = wx.TextEntryDialog(None, 'What is your name?',
                                     'Welcome User', 'Joy')

        if nameBox.ShowModal() == wx.ID_OK:
            userName = nameBox.GetValue()

        #yesNoBox = wx.MessageDialog(None, 'Do you like this?', 'Question', wx.YES_NO)
        #yesNoAnswer = yesNoBox.ShowModal()
        #yesNoBox.Destroy()

        #if yesNoAnswer == wx.ID_NO:
        #userName = '******'

        chooseOneBox = wx.SingleChoiceDialog(
            None, 'Search for the files to be checked daily',
            'Browse for Folders',
            ['Folder A', 'Folder B', 'Folder C', 'Folder D'])

        if chooseOneBox.ShowModal() == wx.ID_OK:
            folder = chooseOneBox.GetStringSelection()

        wx.TextCtrl(panel, pos=(3, 100), size=(150, 50))

        aweText = wx.StaticText(panel, -1, "You chose Folder...", (3, 3))
        aweText.SetForegroundColour('black')
        aweText.SetBackgroundColour('white')

        rlyAweText = wx.StaticText(
            panel, -1,
            "Choose 'file', then 'check' to execute checking process ",
            (3, 30))
        rlyAweText.SetForegroundColour(folder)
        rlyAweText.SetBackgroundColour('white')

        chooseOneBox = wx.SingleChoiceDialog(
            None, 'Choose the folder to move the files', 'Browse for Folders',
            ['Folder E', 'Folder F', 'Folder G', 'Folder H'])

        if chooseOneBox.ShowModal() == wx.ID_OK:
            folder = chooseOneBox.GetStringSelection()

        wx.TextCtrl(panel, pos=(3, 100), size=(150, 50))

        self.SetTitle('Welcome ' + userName)
        self.Show(True)
Пример #9
0
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import os # osモジュールのインポート
import wx
 
# os.listdir('パス')
# 指定したパス内の全てのファイルとディレクトリを要素とするリストを返す
#files = os.listdir("\\homeserver1\movies\'")
files = os.listdir("Z:\MUSICS")

application = wx.App()

frame = wx.Frame(None, wx.ID_ANY, u"テストフレーム", size=(300,200))
panel = wx.Panel(frame, wx.ID_ANY)
panel.SetBackgroundColour("#AFAFAF")
listbox = wx.ListBox(panel, wx.ID_ANY)

for file in files:
    listbox.Append(file)

layout = wx.GridSizer(1, 1)
layout.Add(listbox, flag=wx.GROW | wx.ALL, border=10)
 
panel.SetSizer(layout)
 
frame.Show()
application.MainLoop()

"""
element_array = ("element_1", "element_2", "element_4", "element_3", "element_5")
Пример #10
0
    def show_minibuffer(self, minibuffer, **kwargs):
        # minibuffer_pane_info is stored in the TaskWindow instance because all
        # tasks use the same minibuffer pane in the AUI manager
        try:
            info = self.window.minibuffer_pane_info
            log.debug("minibuffer pane exists: %s" % info)
        except AttributeError:
            panel = wx.Panel(self.window.control,
                             name="minibuffer_parent",
                             style=wx.NO_BORDER)
            sizer = wx.BoxSizer(wx.HORIZONTAL)
            close_image = ImageResource('cancel')
            bmp = close_image.create_bitmap()
            close = wx.BitmapButton(panel,
                                    -1,
                                    bmp,
                                    size=(bmp.GetWidth() + 10,
                                          bmp.GetHeight() + 10),
                                    style=wx.NO_BORDER)
            close.Bind(wx.EVT_BUTTON, self.on_hide_minibuffer_or_cancel)
            sizer.Add(close, 0, wx.EXPAND)
            panel.SetSizer(sizer)
            info = self.create_minibuffer_info()
            self.window._aui_manager.AddPane(panel, info)
            # info.window is set to panel in the AUI code
            self.window.minibuffer_pane_info = info
            info.close_button = close
            log.debug("created minibuffer pane: %s" % info)
        repeat = False
        if info.minibuffer is not None:
            if info.minibuffer.is_repeat(minibuffer):
                log.debug("Reusing old minibuffer control: %s" %
                          info.minibuffer.control)
                repeat = True
            else:
                log.debug("Removing old minibuffer control: %s" %
                          info.minibuffer.control)
                info.window.GetSizer().Hide(0)
                info.window.GetSizer().Remove(0)
                info.minibuffer.destroy_control()
                log.debug("Children: %s" % info.window.GetSizer().Children)
        force_update = False
        if not repeat:
            minibuffer.create_control(info.window)
            info.close_button.Show(minibuffer.show_close_button)
            info.window.GetSizer().Insert(0, minibuffer.control, 1, wx.EXPAND)

            # force minibuffer parent panel to take min size of contents of
            # minibuffer. Apparently this doesn't happen automatically.
            #
            # FIXME: or maybe it does. Removing all the min size stuff now
            # seems to work. Maybe because prior I had been setting the min
            # size after the Fit?
            min_size = minibuffer.control.GetMinSize()
            #            info.window.SetMinSize(min_size)
            #            info.BestSize(min_size)  # Force minibuffer height, just in case

            info.window.Fit()  # Fit instead of Layout to prefer control size
            minibuffer.focus()
            info.minibuffer = minibuffer
            log.debug("Window: %s, info: %s, size: %s" %
                      (self.window, info, info.best_size))
            force_update = True
        else:
            log.debug("Repeat: %s, info: %s" % (self.window, info))
            info.minibuffer.focus()
            info.minibuffer.repeat(minibuffer)  # Include new minibuffer
        if not info.IsShown():
            info.Show()
            force_update = True
        if force_update:
            self.window._aui_manager.Update()
        log.debug("size after update: %s best=%s min=%s" %
                  (info.window.GetSize(), info.best_size, info.min_size))
Пример #11
0
    def __init__(self, parent=None):
        wx.Frame.__init__(self, parent=parent, title="Channel Archiver")
        from Icon import SetIcon
        SetIcon(self, "Archiver")

        self.panel = wx.Panel(self)

        border = wx.BoxSizer(wx.VERTICAL)

        flag = wx.ALL | wx.EXPAND
        box = wx.BoxSizer(wx.VERTICAL)
        from wx import grid
        self.Table = grid.Grid(self.panel)
        nrows = max(len(self.PVs), 1)
        self.Table.CreateGrid(nrows, 4)
        self.Table.SetRowLabelSize(20)  # 1,2,...
        self.Table.SetColLabelSize(20)
        self.Table.SetColLabelValue(0, "Log")
        self.Table.SetColLabelValue(1, "Description")
        self.Table.SetColLabelValue(2, "Process Variable")
        self.Table.SetColLabelValue(3, "Value")

        for i in range(0, min(nrows, len(self.PVs))):
            if i < len(self.PVsuse) and self.PVsuse[i]: text = "Yes"
            else: text = "No"
            self.Table.SetCellValue(i, 0, text)
            if i < len(self.PVnames):
                self.Table.SetCellValue(i, 1, self.PVnames[i])
            self.Table.SetCellValue(i, 2, self.PVs[i])

        self.Table.AutoSize()
        self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnEnterCell, self.Table)
        self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnSelectCell, self.Table)
        box.Add(self.Table, flag=flag, proportion=1)

        buttons = wx.BoxSizer()
        button = wx.Button(self.panel, label="+", style=wx.BU_EXACTFIT)
        self.Bind(wx.EVT_BUTTON, self.add_row, button)
        buttons.Add(button, flag=flag)
        size = button.GetSize()
        button = wx.Button(self.panel, label="-", size=size)
        self.Bind(wx.EVT_BUTTON, self.delete_row, button)
        buttons.Add(button, flag=flag)
        box.Add(buttons, flag=flag)

        # Leave a 10-pixel wide space around the panel.
        border.Add(box, flag=flag, border=10, proportion=1)

        flag = wx.ALL | wx.EXPAND
        group = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, label="Destination:")
        group.Add(label, flag=flag)
        style = wx.TE_PROCESS_ENTER
        self.Directory = TextCtrl(self.panel, size=(250, -1), style=style)
        self.Directory.Value = channel_archiver.directory
        self.Bind(wx.EVT_TEXT_ENTER, self.OnDirectory, self.Directory)
        group.Add(self.Directory, flag=flag, proportion=1)
        button = wx.Button(self.panel, label="Browse...")
        self.Bind(wx.EVT_BUTTON, self.OnBrowse, button)
        group.Add(button, flag=flag)
        # Leave a 10-pixel wide space around the panel.
        flag = wx.ALL | wx.EXPAND
        border.Add(group, flag=flag, border=10)

        buttons = wx.BoxSizer()
        button = wx.ToggleButton(self.panel, label="Active")
        self.Bind(wx.EVT_TOGGLEBUTTON, self.OnActive, button)
        buttons.Add(button, flag=flag)
        buttons.AddSpacer((10, 10))
        button = wx.Button(self.panel, label="Test")
        self.Bind(wx.EVT_BUTTON, self.test, button)
        buttons.Add(button, flag=flag)
        # Leave a 10-pixel wide space around the panel.
        border.Add(buttons, flag=flag, border=10)

        self.panel.Sizer = border
        self.panel.Fit()
        self.Fit()
        self.Show()

        self.Bind(wx.EVT_SIZE, self.OnResize)
Пример #12
0
    def __init__(self, parent=None):
        wx.Frame.__init__(self, parent, wx.ID_ANY, __appname__,
                          style=self.FRAME_STYLE, name="MainFrame")
        self.__active = False

        supported_files = SurveyReader.supported_files()
        supported_extensions = []
        for supported_file in supported_files:
            supported_extensions.append(supported_file[-1])
        supported_extensions = list(set(supported_extensions))

        file_types_string = ""
        for extension in supported_extensions:
            file_types_string += "*.%s;" % extension
        file_types_string = file_types_string.strip(';')

        wildcard = "Supported files (%s)|%s" % (
        file_types_string, file_types_string)

        if(hasattr(self, 'SetMinClientSize')):
            self.SetMinClientSize(wx.Size(400, -1))

        self._panel = wx.Panel(self)

        self._source_file_label = wx.StaticText(self._panel,
                                                label=self.SURVEY_LABEL_TEXT)
        self._source_file_ctrl = wx.FilePickerCtrl(self._panel,
                                                   message=self.SURVEY_FILE_CTRL_MESSAGE,
                                                   wildcard=wildcard)

        self._writers = SurveyWriter.__subclasses__()
        writer_types = []
        for writer in self._writers:
            writer_types.append(writer.file_type())

        self._writers_panel = wx.RadioBox(self._panel, label="Convert to:",
                                          majorDimension=1,
                                          choices=writer_types,
                                          style=wx.RA_SPECIFY_ROWS,
                                          name="SelectedWriter")

        self._license_checkbox = wx.CheckBox(self._panel, style=wx.CHK_2STATE,
                                             label=self.LICENSE_LABEL_TEXT,
                                             name="AddLicense")
        self._license_checkbox.SetValue(True)
        self._license_textfield = wx.TextCtrl(self._panel,
                                              style=wx.TE_MULTILINE,
                                              size=(-1, 60),
                                              name="LicenseText")
        self._license_textfield.SetValue(self.LICENSE_TEXT)

        self._save_button = wx.Button(self._panel, label="Save")
        self._save_button.Bind(wx.EVT_BUTTON, self._on_save)

        if sys.platform == "win32":
            self._source_file_ctrl.GetPickerCtrl().SetLabel("Browse...")

        self._add_sizers()

        self._toggle_export_interface(False)

        self.Center()

        self._register_and_restore()

        self.Bind(wx.EVT_CLOSE, self._on_exit)
        self._source_file_ctrl.Bind(wx.EVT_FILEPICKER_CHANGED,
                                    self._on_file_selected)
Пример #13
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           "Make an example file",
                           size=(800, 500))
        self.Panel = wx.Panel(self)

        self.done = False
        self.result = None

        MainSizer = wx.BoxSizer(wx.VERTICAL)

        self.TitleDescription = wx.TextCtrl(self.Panel, -1, "")
        self.Description = wx.TextCtrl(self.Panel,
                                       -1,
                                       "",
                                       style=wx.TE_MULTILINE)
        self.Image = OpenImage(self.Panel)
        self.DoneButton = wx.Button(self.Panel, -1, "Done")

        MainSizer.Add((-1, 10))
        top_sizer = wx.BoxSizer(wx.HORIZONTAL)
        top_sizer.Add(wx.StaticText(self.Panel, -1, "Name"),
                      0,
                      flag=wx.RIGHT | wx.RIGHT | wx.CENTER,
                      border=5)
        top_sizer.Add(self.TitleDescription, 2, flag=wx.CENTER | wx.EXPAND)
        MainSizer.Add(top_sizer,
                      0,
                      wx.EXPAND | wx.CENTER | wx.LEFT | wx.RIGHT,
                      border=5)
        MainSizer.Add((-1, 10))

        middle_sizer = wx.BoxSizer(wx.HORIZONTAL)
        for item, title in ((self.Description, "Description"), (self.Image,
                                                                "Image")):

            t_sizer = wx.BoxSizer(wx.VERTICAL)
            t_sizer.Add(wx.StaticText(self.Panel, -1, title),
                        0,
                        wx.CENTER | wx.BOTTOM | wx.CENTER,
                        border=5)
            t_sizer.Add(item, 2, wx.EXPAND | wx.CENTER)

            middle_sizer.Add(t_sizer, 1, wx.EXPAND | wx.RIGHT, border=5)

        MainSizer.Add(middle_sizer, 2,
                      wx.RIGHT | wx.LEFT | wx.EXPAND | wx.CENTER, 5)
        MainSizer.Add((-1, 10))
        MainSizer.Add(self.DoneButton,
                      0,
                      flag=wx.CENTER | wx.EXPAND | wx.RIGHT | wx.LEFT,
                      border=25)
        MainSizer.Add((-1, 10))

        self.Panel.SetSizer(MainSizer)

        tmp_sizer = wx.BoxSizer(wx.VERTICAL)
        tmp_sizer.Add(self.Panel, 1, wx.EXPAND)

        self.SetSizer(tmp_sizer)

        self.Center()

        self.Bind(wx.EVT_BUTTON, self.OnDone, self.DoneButton)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
Пример #14
0
def runTest(frame, nb, log):
    if not _USE_PANEL:
        ed = p = MySTC(nb, -1, log)

    else:
        p = wx.Panel(nb, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE)
        ed = MySTC(p, -1, log)
        s = wx.BoxSizer(wx.HORIZONTAL)
        s.Add(ed, 1, wx.EXPAND)
        p.SetSizer(s)
        p.SetAutoLayout(True)


    #ed.SetBufferedDraw(False)
    #ed.StyleClearAll()
    #ed.SetScrollWidth(800)
    #ed.SetWrapMode(True)
    #ed.SetUseAntiAliasing(False)
    #ed.SetViewEOL(True)

    #ed.CmdKeyClear(stc.STC_KEY_BACK,
    #               stc.STC_SCMOD_CTRL)
    #ed.CmdKeyAssign(stc.STC_KEY_BACK,
    #                stc.STC_SCMOD_CTRL,
    #                stc.STC_CMD_DELWORDLEFT)

    ed.SetText(demoText)

    # if wx.USE_UNICODE:
    import codecs
    decode = codecs.lookup("utf-8")[1]

    ed.GotoPos(ed.GetLength())
    ed.AddText("\n\nwx.StyledTextCtrl can also do Unicode:\n")
    uniline = ed.GetCurrentLine()
    unitext, l = decode('\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd - '
                        '\xd0\xbb\xd1\x83\xd1\x87\xd1\x88\xd0\xb8\xd0\xb9 '
                        '\xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba \xd0\xbf\xd1\x80\xd0\xbe\xd0\xb3\xd1\x80\xd0\xb0\xd0\xbc\xd0\xbc\xd0\xb8\xd1\x80\xd0\xbe\xd0\xb2\xd0\xb0\xd0\xbd\xd0\xb8\xd1\x8f!\n\n')
    ed.AddText('\tRussian: ')
    ed.AddText(unitext)
    ed.GotoPos(0)
    #else:
    #    #ed.StyleSetFontEncoding(stc.STC_STYLE_DEFAULT, wx.FONTENCODING_KOI8)
    #    #text = u'\u041f\u0438\u0442\u043e\u043d - \u043b\u0443\u0447\u0448\u0438\u0439 \u044f\u0437\u044b\u043a \n\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f!'
    #    #text = text.encode('koi8-r')
    #    #ed.StyleSetFontEncoding(stc.STC_STYLE_DEFAULT, wx.FONTENCODING_BIG5)
    #    #text = u'Python \u662f\u6700\u597d\u7684\u7de8\u7a0b\u8a9e\u8a00\uff01'
    #    #text = text.encode('big5')
    #    ed.GotoPos(ed.GetLength())
    #    ed.AddText('\n\n' + text)

    ed.EmptyUndoBuffer()

    # make some styles
    ed.StyleSetSpec(stc.STC_STYLE_DEFAULT, "size:%d,face:%s" % (pb, face3))
    ed.StyleClearAll()
    ed.StyleSetSpec(1, "size:%d,bold,face:%s,fore:#0000FF" % (pb, face1))
    ed.StyleSetSpec(2, "face:%s,italic,fore:#FF0000,size:%d" % (face2, pb))
    ed.StyleSetSpec(3, "face:%s,bold,size:%d" % (face2, pb))
    ed.StyleSetSpec(4, "face:%s,size:%d" % (face1, pb-1))

    # Now set some text to those styles...  Normally this would be
    # done in an event handler that happens when text needs displayed.
    ed.StartStyling(98, 0xff)
    ed.SetStyling(6, 1)  # set style for 6 characters using style 1

    ed.StartStyling(190, 0xff)
    ed.SetStyling(20, 2)

    ed.StartStyling(310, 0xff)
    ed.SetStyling(4, 3)
    ed.SetStyling(2, 0)
    ed.SetStyling(10, 4)


    # line numbers in the margin
    ed.SetMarginType(0, stc.STC_MARGIN_NUMBER)
    ed.SetMarginWidth(0, 22)
    ed.StyleSetSpec(stc.STC_STYLE_LINENUMBER, "size:%d,face:%s" % (pb-2, face1))

    # setup some markers
    ed.SetMarginType(1, stc.STC_MARGIN_SYMBOL)
    ed.MarkerDefine(0, stc.STC_MARK_ROUNDRECT, "#CCFF00", "RED")
    ed.MarkerDefine(1, stc.STC_MARK_CIRCLE, "FOREST GREEN", "SIENNA")
    ed.MarkerDefine(2, stc.STC_MARK_SHORTARROW, "blue", "blue")
    ed.MarkerDefine(3, stc.STC_MARK_ARROW, "#00FF00", "#00FF00")

    # put some markers on some lines
    ed.MarkerAdd(17, 0)
    ed.MarkerAdd(18, 1)
    ed.MarkerAdd(19, 2)
    ed.MarkerAdd(20, 3)
    ed.MarkerAdd(20, 0)


    # and finally, an indicator or two
    ed.IndicatorSetStyle(0, stc.STC_INDIC_SQUIGGLE)
    ed.IndicatorSetForeground(0, wx.RED)
    ed.IndicatorSetStyle(1, stc.STC_INDIC_DIAGONAL)
    ed.IndicatorSetForeground(1, wx.BLUE)
    ed.IndicatorSetStyle(2, stc.STC_INDIC_STRIKE)
    ed.IndicatorSetForeground(2, wx.RED)

    ed.StartStyling(836, stc.STC_INDICS_MASK)
    ed.SetStyling(10, stc.STC_INDIC0_MASK)
    ed.SetStyling(8, stc.STC_INDIC1_MASK)
    ed.SetStyling(10, stc.STC_INDIC2_MASK | stc.STC_INDIC1_MASK)


    # some test stuff...
    if debug:
        print("GetTextLength(): ", ed.GetTextLength(), len(ed.GetText()))
        print("GetText(): ", repr(ed.GetText()))
        print()
        print("GetStyledText(98, 104): ", repr(ed.GetStyledText(98, 104)), len(ed.GetStyledText(98, 104)))
        print()
        print("GetCurLine(): ", repr(ed.GetCurLine()))
        ed.GotoPos(5)
        print("GetCurLine(): ", repr(ed.GetCurLine()))
        print()
        print("GetLine(1): ", repr(ed.GetLine(1)))
        print()
        ed.SetSelection(25, 35)
        print("GetSelectedText(): ", repr(ed.GetSelectedText()))
        print("GetTextRange(25, 35): ", repr(ed.GetTextRange(25, 35)))
        print("FindText(0, max, 'indicators'): ", 
              ed.FindText(0, ed.GetTextLength(), "indicators"))
        # if wx.USE_UNICODE:
        end = ed.GetLength()
        start = ed.PositionFromLine(uniline)
        print("GetTextRange(%d, %d): " % (start, end),)
        print(repr(ed.GetTextRange(start, end)))


    wx.CallAfter(ed.GotoPos, 0)
    return p
Пример #15
0
    def __init__(self, frame, title, params, order,
                 helpUrl=None, suppressTitles=True, size=(800,400),
                 style=_style, editing=False, depends=[],
                 timeout=None, type="Code"):

        # translate title
        localizedTitle = title.replace(' Properties',
                                       _translate(' Properties'))
        wx.Dialog.__init__(self, None, -1, localizedTitle,
                           size=size, style=self._style)
        self.SetTitle(localizedTitle)  # use localized title
        # self.panel = wx.Panel(self)
        self.frame = frame
        self.app = frame.app
        self.helpUrl = helpUrl
        self.params = params  # dict
        self.order = order
        self.title = title
        self.timeout = timeout
        self.warningsDict = {}  # to store warnings for all fields
        self.codeBoxes = {}
        self.tabs = OrderedDict()

        if not editing and 'name' in self.params:
            # then we're adding a new component so ensure a valid name:
            makeValid = self.frame.exp.namespace.makeValid
            self.params['name'].val = makeValid(params['name'].val)

        self.codeNotebook = wx.Notebook(self)
        # in AUI notebook the labels are blurry on retina mac
        #   and the close-tab buttons are hard to kill
        #   self.codeNotebook = aui.AuiNotebook(self)
        # in FlatNoteBook the tab controls (left,right,close) are ugly on mac
        #   and also can't be killed

        openToPage = None
        tabN = -1
        for paramN, paramName in enumerate(self.order):
            param = self.params.get(paramName)
            if paramName == 'name':
                self.nameLabel = wx.StaticText(self, wx.ID_ANY,
                                               _translate(param.label))
                _style = wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB
                self.componentName = wx.TextCtrl(self, wx.ID_ANY,
                                                 str(param.val),
                                                 style=_style)
                self.componentName.SetToolTip(wx.ToolTip(
                        _translate(param.hint)))
                self.componentName.SetValidator(validators.NameValidator())
                self.nameOKlabel = wx.StaticText(self, -1, '',
                                                 style=wx.ALIGN_RIGHT)
                self.nameOKlabel.SetForegroundColour(wx.RED)
            elif paramName == 'Code Type':
                # Create code type choice menu
                _codeTypes = self.params['Code Type'].allowedVals
                _selectedCodeType = self.params['Code Type'].val
                _selectedCodeTypeIndex = _codeTypes.index(_selectedCodeType)
                self.codeTypeMenu = wx.Choice(self, choices=_codeTypes)
                # If user does not have metapensiero but codetype is auto-js, revert to (Py?)
                if not hasMetapensiero and _selectedCodeType.lower() == 'auto->js':
                    _selectedCodeTypeIndex -= 1
                # Set selection to value stored in self params
                self.codeTypeMenu.SetSelection(_selectedCodeTypeIndex)
                self.codeTypeMenu.Bind(wx.EVT_CHOICE, self.onCodeChoice)
                self.codeTypeName = wx.StaticText(self, wx.ID_ANY,
                                                  _translate(param.label))
            else:
                codeType = ["Py", "JS"]["JS" in paramName]  # Give CodeBox a code type
                tabName = paramName.replace("JS ", "")
                if tabName in self.tabs:
                    _panel = self.tabs[tabName]
                else:
                    _panel = wx.Panel(self.codeNotebook, wx.ID_ANY)
                    _panel.app = self.app
                    self.tabs[tabName] = _panel
                    tabN += 1

                self.codeBoxes[paramName] = CodeBox(_panel, wx.ID_ANY,
                                                    pos=wx.DefaultPosition,
                                                    style=0,
                                                    prefs=self.app.prefs,
                                                    params=params,
                                                    codeType=codeType)
                self.codeBoxes[paramName].AddText(param.val)
                self.codeBoxes[paramName].Bind(wx.EVT_KEY_UP, self.onKeyUp)  # For real time translation

                if len(param.val.strip()) and openToPage is None:
                    # index of first non-blank page
                    openToPage = tabN

        if self.helpUrl is not None:
            self.helpButton = wx.Button(self, wx.ID_HELP,
                                        _translate(" Help "))
            tip = _translate("Go to online help about this component")
            self.helpButton.SetToolTip(wx.ToolTip(tip))
        self.okButton = wx.Button(self, wx.ID_OK, _translate(" OK "))
        self.okButton.SetDefault()
        self.cancelButton = wx.Button(self, wx.ID_CANCEL,
                                      _translate(" Cancel "))
        self.__do_layout()
        if openToPage is None:
            openToPage = 1
        self.codeNotebook.SetSelection(openToPage)
        self.Update()
        self.Bind(wx.EVT_BUTTON, self.helpButtonHandler, self.helpButton)

        if self.timeout:
            timeout = wx.CallLater(self.timeout, self.onEnter)
            timeout.Start()
        # do show and process return
        ret = self.ShowModal()

        if ret == wx.ID_OK:
            self.checkName()
            self.OK = True
            self.params = self.getParams()  # get new vals from dlg
            self.Validate()
        else:
            self.OK = False
Пример #16
0
    def __init__(self, parent, flow, **kwargs):
        """
        Args:
            parent:
                Parent window.
            flow:
                `AbinitFlow` with the list of `Workflow` objects.
        """
        if "title" not in kwargs:
            kwargs["title"] = self.codename

        super(FlowViewerFrame, self).__init__(parent, -1, **kwargs)

        # This combination of options for config seems to work on my Mac.
        self.config = wx.FileConfig(appName=self.codename,
                                    localFilename=self.codename + ".ini",
                                    style=wx.CONFIG_USE_LOCAL_FILE)

        # Build menu, toolbar and status bar.
        self.SetMenuBar(self.makeMenu())
        self.makeToolBar()
        self.statusbar = self.CreateStatusBar()
        self.Centre()

        self.flow = flow

        # Disable launch mode if we already executing the flow with the scheduler.
        self.check_launcher_file()

        # Build UI
        self.panel = panel = wx.Panel(self, -1)
        self.main_sizer = main_sizer = wx.BoxSizer(wx.VERTICAL)

        # Here we create a panel and a notebook on the panel
        self.notebook = FlowNotebook(panel, self.flow)
        main_sizer.Add(self.notebook, 1, wx.EXPAND, 5)

        submit_button = wx.Button(panel, -1, label='Submit')
        submit_button.Bind(wx.EVT_BUTTON, self.OnSubmitButton)

        text = wx.StaticText(panel, -1, "Max nlaunch:")
        text.Wrap(-1)
        text.SetToolTipString(
            "Maximum number of tasks that can be submitted. Use -1 for unlimited launches."
        )
        self.max_nlaunch = wx.SpinCtrl(panel,
                                       -1,
                                       value=str(get_ncpus()),
                                       min=-1)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.Add(submit_button, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
        hsizer.Add(text, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
        hsizer.Add(self.max_nlaunch, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
        main_sizer.Add(hsizer, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)

        panel.SetSizerAndFit(main_sizer)

        # Register this event when the GUI is IDLE
        # Not used anymore since the Yaml parser
        # is very slow when we use the pure python version.
        self.last_refresh = time.time()
    def MyPanel1(self):
        #wx.Panel.MyPanel1 ( self, id = -1, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )
        self.panelNum = 2
        self.mypanel1_panel = wx.Panel(self, pos=(0, 0), size=(500, 400))
        #字体(大小,字体DECORATIVE,斜度,醒目程度)
        font1 = wx.Font(25, wx.ROMAN, wx.ITALIC, wx.LIGHT)
        font2 = wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        font3 = wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.NORMAL)

        bSizer2 = wx.BoxSizer(wx.VERTICAL)

        self.wel_la = wx.StaticText(self.mypanel1_panel, -1,
                                    u"  Welcome to the system~",
                                    wx.DefaultPosition, wx.DefaultSize, 0)
        self.wel_la.Wrap(-1)
        self.wel_la.SetFont(font1)
        self.wel_la.SetForegroundColour("#E6E6FA")
        bSizer2.Add(self.wel_la, 0, wx.ALL, 5)
        #竖直的一行两列,纵横向间距

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

        self.en_la = wx.StaticText(self.mypanel1_panel,
                                   -1,
                                   u"     PART 1",
                                   pos=(100, 100),
                                   size=(150, 30))
        self.en_la.SetForegroundColour("#EAEAEA")
        self.en_la.SetFont(font2)
        #self.en_la.SetBackgroundColour("#EAEAEA")
        #self.en_la.Wrap( -1 )
        gSizer2.Add(self.en_la, 0, wx.LEFT | wx.TOP, 70)

        self.de_la = wx.StaticText(self.mypanel1_panel,
                                   -1,
                                   u"     PART 2",
                                   pos=(0, 100),
                                   size=(150, 30))
        self.de_la.SetForegroundColour("#4D4D4D")
        self.de_la.SetFont(font2)
        #self.de_la.SetBackgroundColour("#EAEAEA")
        self.de_la.Wrap(-1)
        gSizer2.Add(self.de_la, 0, wx.RIGHT | wx.TOP, 70)

        self.button_en = wx.Button(self.mypanel1_panel,
                                   -1,
                                   u"水印嵌入",
                                   pos=(0, 100),
                                   size=(150, 50))
        self.button_en.SetFont(font3)

        gSizer2.Add(self.button_en, 0, wx.LEFT | wx.BOTTOM, 70)
        self.button_en.Bind(wx.EVT_BUTTON, self.click_en)

        self.button_de = wx.Button(self.mypanel1_panel,
                                   -1,
                                   u"水印提取",
                                   pos=(0, 100),
                                   size=(150, 50))
        self.button_de.SetFont(font3)
        gSizer2.Add(self.button_de, 0, wx.RIGHT | wx.BOTTOM, 70)
        self.button_de.Bind(wx.EVT_BUTTON, self.click_de)

        bSizer2.Add(gSizer2, 1, wx.EXPAND, 5)

        self.SetSizer(bSizer2)
        self.Layout()

        #绑定事件
        self.mypanel1_panel.Bind(wx.EVT_ERASE_BACKGROUND,
                                 self.login_background)
Пример #18
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, wx.ID_ANY)

        self.frame = parent
        self.left_panel = wx.Panel(self, wx.ID_ANY)
        self.plot_panel = wx.Panel(self, wx.ID_ANY, style=wx.SIMPLE_BORDER)

        # PLOT Panel ---------------------------------------------------------------------------------------------------
        self.figure = plt.figure(figsize=(1,
                                          1))  # look into Figure((5, 4), 75)
        self.canvas = FigureCanvas(self.plot_panel, -1, self.figure)
        self.toolbar = NavigationToolbar(self.canvas)
        self.toolbar.Realize()

        self.ax1 = self.figure.add_subplot(211)
        self.ax2 = self.figure.add_subplot(212)

        self.temporal, = self.ax1.plot([], [],
                                       linestyle='-',
                                       linewidth=5,
                                       alpha=0.3)
        self.temporal_sampled, = self.ax1.plot([], [],
                                               linestyle='-',
                                               marker='x')
        self.spectral, = self.ax2.plot([], [], color='#C02942')
        self.x, self.y = [], []

        self.text_ctrl_fs = wx.TextCtrl(self.left_panel,
                                        wx.ID_ANY,
                                        style=wx.TE_PROCESS_ENTER)
        self.text_ctrl_ldf = wx.TextCtrl(self.left_panel,
                                         wx.ID_ANY,
                                         style=wx.TE_PROCESS_ENTER)
        self.text_ctrl_ldf.SetToolTip("Lowest Recoverable Frequency")

        self.text_ctrl_samples = wx.TextCtrl(self.left_panel,
                                             wx.ID_ANY,
                                             "",
                                             style=wx.TE_READONLY)
        self.text_ctrl_rms_true = wx.TextCtrl(self.left_panel,
                                              wx.ID_ANY,
                                              "",
                                              style=wx.TE_READONLY)
        self.text_ctrl_rms_sampled = wx.TextCtrl(self.left_panel,
                                                 wx.ID_ANY,
                                                 "",
                                                 style=wx.TE_READONLY)
        self.text_ctrl_rms_delta = wx.TextCtrl(self.left_panel,
                                               wx.ID_ANY,
                                               "",
                                               style=wx.TE_READONLY)

        self.text_ctrl_cycles = wx.TextCtrl(self.left_panel,
                                            wx.ID_ANY,
                                            "",
                                            style=wx.TE_READONLY)
        self.text_ctrl_samples_per_cycle = wx.TextCtrl(self.left_panel,
                                                       wx.ID_ANY,
                                                       "",
                                                       style=wx.TE_READONLY)
        self.text_ctrl_aliased_freq01 = wx.TextCtrl(self.left_panel,
                                                    wx.ID_ANY,
                                                    "",
                                                    style=wx.TE_READONLY)
        self.text_ctrl_aliased_freq02 = wx.TextCtrl(self.left_panel,
                                                    wx.ID_ANY,
                                                    "",
                                                    style=wx.TE_READONLY)
        self.text_ctrl_aliased_freq03 = wx.TextCtrl(self.left_panel,
                                                    wx.ID_ANY,
                                                    "",
                                                    style=wx.TE_READONLY)

        on_update = lambda event: self.update(event)
        self.Bind(wx.EVT_TEXT_ENTER, on_update, self.text_ctrl_fs)
        self.Bind(wx.EVT_TEXT_ENTER, on_update, self.text_ctrl_ldf)

        self.__set_properties()
        self.__do_layout()
        self.__do_plot_layout()
        self.update(wx.Event)
    def MyPanel3(self):
        #wx.Panel.MyPanel3 ( self, id = -1, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )
        self.panelNum = 4
        self.mypanel3_panel = wx.Panel(self, pos=(0, 0), size=(500, 400))
        font1 = wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.LIGHT)
        font2 = wx.Font(24, wx.ROMAN, wx.ITALIC, wx.LIGHT)
        font3 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.LIGHT)

        bSizer4 = wx.BoxSizer(wx.VERTICAL)
        self.ok_la1 = wx.StaticText(self, -1, u"   ", wx.DefaultPosition,
                                    wx.DefaultSize, 0)
        self.ok_la1.Wrap(-1)
        bSizer4.Add(self.ok_la1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5)

        self.info_la = wx.StaticText(self.mypanel3_panel,
                                     -1,
                                     u"  原信息流",
                                     pos=(100, 100),
                                     size=(380, 20))
        self.info_la.SetForegroundColour("#F7F7F7")
        self.info_la.Wrap(-1)
        bSizer4.Add(self.info_la, 0, wx.TOP | wx.RIGHT, 20)

        self.info_txt = wx.TextCtrl(self.mypanel3_panel,
                                    -1,
                                    self.info1,
                                    pos=(100, 100),
                                    size=(400, 50),
                                    style=wx.TE_MULTILINE)
        bSizer4.Add(self.info_txt, 0, wx.ALL | wx.EXPAND, 5)

        self.info_la = wx.StaticText(self.mypanel3_panel,
                                     -1,
                                     u"  加密信息流",
                                     pos=(100, 100),
                                     size=(380, 20))
        self.info_la.SetForegroundColour("#F7F7F7")
        self.info_la.Wrap(-1)
        bSizer4.Add(self.info_la, 0, wx.TOP | wx.RIGHT, 20)

        self.info_txt = wx.TextCtrl(self.mypanel3_panel,
                                    -1,
                                    self.cc_e,
                                    pos=(100, 100),
                                    size=(400, 50),
                                    style=wx.TE_MULTILINE)
        bSizer4.Add(self.info_txt, 0, wx.ALL | wx.EXPAND, 5)

        self.ok_la = wx.StaticText(self, -1, u"---------图片---已生成---------",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        self.ok_la.SetFont(font2)
        self.ok_la.SetForegroundColour("#4F94CD")
        self.ok_la.Wrap(-1)
        bSizer4.Add(self.ok_la, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 15)

        gSizer5 = wx.GridSizer(1, 2, 0, 0)

        self.button5 = wx.Button(self, -1, u"<-返回", wx.DefaultPosition,
                                 wx.DefaultSize, 0)
        gSizer5.Add(self.button5, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM,
                    5)

        self.button6 = wx.Button(self, -1, u"完成", wx.DefaultPosition,
                                 wx.DefaultSize, 0)
        gSizer5.Add(self.button6, 0, wx.ALL | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT,
                    5)

        bSizer4.Add(gSizer5, 1, wx.EXPAND, 5)

        self.SetSizer(bSizer4)
        self.Layout()

        #绑定事件
        self.button5.Bind(wx.EVT_BUTTON, self.back_click)
        #self.button6.Bind( wx.EVT_BUTTON, self.click_over )
        self.mypanel3_panel.Bind(wx.EVT_ERASE_BACKGROUND,
                                 self.login_background)
Пример #20
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.statusbar = self.CreateStatusBar(5, wx.ST_SIZEGRIP)
        self.SplitterWindow = wx.SplitterWindow(self,
                                                wx.ID_ANY,
                                                style=wx.SP_3D | wx.SP_BORDER
                                                | wx.SP_LIVE_UPDATE)
        self.window_1_pane_1 = wx.ScrolledWindow(self.SplitterWindow,
                                                 wx.ID_ANY,
                                                 style=wx.SIMPLE_BORDER
                                                 | wx.TAB_TRAVERSAL)
        self.pnlSettingBar = wx.Panel(self.window_1_pane_1, wx.ID_ANY)
        self.btnHideBar = wx.Button(self.pnlSettingBar, wx.ID_ANY, "Hide")
        self.btnEnumPorts = wx.Button(self.pnlSettingBar, wx.ID_ANY,
                                      "EnumPorts")
        self.label_1 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY, "Port")
        self.cmbPort = wx.ComboBox(self.pnlSettingBar,
                                   wx.ID_ANY,
                                   choices=[],
                                   style=wx.CB_DROPDOWN)
        self.label_2 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY,
                                     "Baud Rate")
        self.cmbBaudRate = wx.ComboBox(
            self.pnlSettingBar,
            wx.ID_ANY,
            choices=[
                "300", "600", "1200", "1800", "2400", "4800", "9600", "19200",
                "38400", "57600", "115200", "230400", "460800", "500000",
                "576000", "921600", "1000000", "1152000", "1500000", "2000000",
                "2500000", "3000000", "3500000", "4000000"
            ],
            style=wx.CB_DROPDOWN)
        self.label_3 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY,
                                     "Data Bits")
        self.choiceDataBits = wx.Choice(self.pnlSettingBar,
                                        wx.ID_ANY,
                                        choices=["5", "6", "7", "8"])
        self.label_4 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY, "Parity")
        self.choiceParity = wx.Choice(
            self.pnlSettingBar,
            wx.ID_ANY,
            choices=["None", "Even", "Odd", "Mark", "Space"])
        self.label_5 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY,
                                     "Stop Bits")
        self.choiceStopBits = wx.Choice(self.pnlSettingBar,
                                        wx.ID_ANY,
                                        choices=["1", "1.5", "2"])
        self.chkboxrtscts = wx.CheckBox(self.pnlSettingBar, wx.ID_ANY,
                                        "RTS/CTS")
        self.chkboxxonxoff = wx.CheckBox(self.pnlSettingBar, wx.ID_ANY,
                                         "Xon/Xoff")
        self.sizer_6_staticbox = wx.StaticBox(self.pnlSettingBar, wx.ID_ANY,
                                              "HandShake")
        self.btnOpen = wx.Button(self.pnlSettingBar, wx.ID_ANY, "Open")
        self.btnClear = wx.Button(self.pnlSettingBar, wx.ID_ANY,
                                  "Clear Screen")
        self.window_1_pane_2 = wx.Panel(self.SplitterWindow, wx.ID_ANY)
        self.pnlData = wx.Panel(self.window_1_pane_2, wx.ID_ANY)
        self.txtctlMain = wx.TextCtrl(
            self.pnlData,
            wx.ID_ANY,
            "",
            style=wx.TE_MULTILINE | wx.TE_RICH | wx.TE_RICH2 | wx.TE_AUTO_URL
            | wx.TE_LINEWRAP | wx.TE_WORDWRAP | wx.NO_BORDER)
        self.pnlTransmitHex = wx.Panel(self.pnlData,
                                       wx.ID_ANY,
                                       style=wx.SIMPLE_BORDER
                                       | wx.TAB_TRAVERSAL)
        self.label_6 = wx.StaticText(self.pnlTransmitHex, wx.ID_ANY,
                                     "Transmit Hex")
        self.btnTransmitHex = wx.Button(self.pnlTransmitHex, wx.ID_ANY,
                                        "Transmit")
        self.txtctlHex = wx.TextCtrl(self.pnlTransmitHex,
                                     wx.ID_ANY,
                                     "",
                                     style=wx.TE_MULTILINE | wx.TE_RICH
                                     | wx.TE_RICH2 | wx.TE_LINEWRAP
                                     | wx.TE_WORDWRAP | wx.NO_BORDER)

        self.__set_properties()
        self.__do_layout()
    def MyPanel4(self):
        #wx.Panel.MyPanel21 ( self, id = -1, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )
        self.mypanel4_panel = wx.Panel(self, pos=(0, 0), size=(500, 400))
        self.panelNum = 5
        font1 = wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.LIGHT)
        font2 = wx.Font(16, wx.ROMAN, wx.ITALIC, wx.LIGHT)
        font3 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.LIGHT)

        bSizer5 = wx.BoxSizer(wx.VERTICAL)

        self.panel4_la = wx.StaticText(self,
                                       wx.ID_ANY,
                                       u"  Please choose the picture",
                                       pos=(100, 100),
                                       size=(50, 50))
        self.panel4_la.SetFont(font2)
        self.panel4_la.SetForegroundColour("#F7F7F7")
        bSizer5.Add(self.panel4_la, 0, wx.ALL | wx.EXPAND, 5)

        gSizer6 = wx.GridSizer(1, 2, 0, 0)

        self.de_la = wx.StaticText(self,
                                   wx.ID_ANY,
                                   u"   请选择图片文件:",
                                   pos=(0, 0),
                                   size=(250, 100))
        self.de_la.SetFont(font3)
        self.de_la.SetForegroundColour("#F7F7F7")
        self.de_la.Wrap(-1)
        gSizer6.Add(self.de_la, 0, wx.ALL, 5)

        m_comboBox2Choices = [
            u"2px_黑体", u"2px_宋体", u"醉翁亭记", u"小石潭记", u"放鹤亭记", u"石钟山记", u"口技",
            u"前赤壁赋", u"岳阳楼记", u"核舟记"
        ]

        self.m_comboBox2 = wx.ComboBox(self, -1, u"请选择文件", wx.DefaultPosition,
                                       wx.DefaultSize, m_comboBox2Choices, 0)
        gSizer6.Add(self.m_comboBox2, 0, wx.ALL, 5)

        bSizer5.Add(gSizer6, 1, wx.EXPAND, 5)

        self.out_la = wx.StaticText(self,
                                    -1,
                                    u"  正在解密中......",
                                    pos=(100, 100),
                                    size=(300, 20))
        self.out_la.SetFont(font3)
        #self.out_la.SetForegroundColour("#F7F7F7")
        self.out_la.Wrap(-1)
        bSizer5.Add(self.out_la, 0, wx.ALL, 5)

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

        self.button7 = wx.Button(self, -1, u"<-返回", wx.DefaultPosition,
                                 wx.DefaultSize, 0)
        gSizer7.Add(self.button7, 0, wx.ALL | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT,
                    5)

        self.button8 = wx.Button(self, -1, u"提取", wx.DefaultPosition,
                                 wx.DefaultSize, 0)
        gSizer7.Add(self.button8, 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT | wx.ALL,
                    5)

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

        self.SetSizer(bSizer5)
        self.Layout()

        #绑定事件
        self.mypanel4_panel.Bind(wx.EVT_ERASE_BACKGROUND,
                                 self.login_background)
        self.m_comboBox2.Bind(wx.EVT_COMBOBOX, self.OnCombo1)
        self.button7.Bind(wx.EVT_BUTTON, self.back_click)
        self.button8.Bind(wx.EVT_BUTTON, self.click_sure)
Пример #22
0
	def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 800,600 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

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

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

		fgSizer3.SetMinSize( wx.Size( 800,500 ) )
		bSizer5 = wx.BoxSizer( wx.HORIZONTAL )

		fgSizer4 = wx.FlexGridSizer( 0, 1, 0, 0 )
		fgSizer4.SetFlexibleDirection( wx.BOTH )
		fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

		bSizer6 = wx.BoxSizer( wx.HORIZONTAL )

		self.m_button4 = wx.Button( self, wx.ID_ANY, u"Reload", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer6.Add( self.m_button4, 0, wx.ALL, 5 )


		fgSizer4.Add( bSizer6, 1, wx.EXPAND, 5 )

		m_listBox_bpyChoices = []
		self.m_listBox_bpy = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox_bpyChoices, 0 )
		self.m_listBox_bpy.SetMinSize( wx.Size( 180,500 ) )

		fgSizer4.Add( self.m_listBox_bpy, 0, wx.ALL, 5 )


		bSizer5.Add( fgSizer4, 1, wx.EXPAND, 5 )


		fgSizer3.Add( bSizer5, 1, wx.EXPAND, 5 )

		bSizer11 = wx.BoxSizer( wx.VERTICAL )

		bSizer11.SetMinSize( wx.Size( 500,500 ) )
		bSizer10 = wx.BoxSizer( wx.HORIZONTAL )

		m_choice_hwndChoices = []
		self.m_choice_hwnd = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice_hwndChoices, 0 )
		self.m_choice_hwnd.SetSelection( 0 )
		self.m_choice_hwnd.SetMinSize( wx.Size( 500,-1 ) )

		bSizer10.Add( self.m_choice_hwnd, 0, wx.ALL, 5 )

		self.m_button3 = wx.Button( self, wx.ID_ANY, u"refresh", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer10.Add( self.m_button3, 0, wx.ALL, 5 )


		bSizer11.Add( bSizer10, 1, wx.EXPAND, 5 )

		self.m_listbook2 = wx.Listbook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LB_RIGHT )
		self.m_listbook2.SetMinSize( wx.Size( -1,500 ) )

		self.m_panel4 = wx.Panel( self.m_listbook2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		self.m_listbook2.AddPage( self.m_panel4, u"head", True )
		self.m_panel5 = wx.Panel( self.m_listbook2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		bSizer9 = wx.BoxSizer( wx.VERTICAL )

		self.m_radioBtn1 = wx.RadioButton( self.m_panel5, wx.ID_ANY, u"RadioBtn", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer9.Add( self.m_radioBtn1, 0, wx.ALL, 5 )


		self.m_panel5.SetSizer( bSizer9 )
		self.m_panel5.Layout()
		bSizer9.Fit( self.m_panel5 )
		self.m_listbook2.AddPage( self.m_panel5, u"hand", False )

		bSizer11.Add( self.m_listbook2, 1, wx.EXPAND |wx.ALL, 5 )


		fgSizer3.Add( bSizer11, 1, wx.EXPAND, 5 )


		self.SetSizer( fgSizer3 )
		self.Layout()

		self.Centre( wx.BOTH )

		# Connect Events
		self.m_listBox_bpy.Bind( wx.EVT_LISTBOX_DCLICK, self.on_list_DClick )
		self.m_choice_hwnd.Bind( wx.EVT_CHOICE, self.on_choice_hwnd )
		self.m_button3.Bind( wx.EVT_BUTTON, self.on_refresh_hwnd )