Ejemplo n.º 1
0
    def __init__(self, parent, title):
        super(Example, self).__init__(parent, title=title, size=(500, 400), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)
        self.isLogged = 0
        self.CreateStatusBar() # A Statusbar in the bottom of the window   
        self.Centre()
        
        # Setting up the menu.
        filemenu= wx.Menu()
        menuAbout= filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
        menuExit = filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")

        # Creating the menubar.
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar
        self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.

        self.sizer2 = wx.BoxSizer(wx.HORIZONTAL)
        
        #Creates controls
        self.emailLabel = wx.StaticText(self, id=-1, label="&Email:", pos=(100, 50), size=(60, 30))
        self.emailBox = wx.TextCtrl(self, id=-1, pos=(145, 45), size=(250, 25))
        self.passwordLabel = wx.StaticText(self, id=-1, label="&Password:"******"&API Key:", pos=(87, 110), size=(60, 30))
        self.apikeyBox = wx.TextCtrl(self, id=-1, pos=(145, 105), size=(250, 25))
        self.locationLabel = wx.StaticText(self, id=-1, label="&Location:", pos=(50, 255), size=(60, 30))
        self.pathBox = wx.TextCtrl(self, id=-1, pos=(120, 250), size=(250, 30))
        self.browseButton = wx.Button(self, id=-1, label="&...", pos=(375, 250), size=(35, 30))
        self.submitButton = wx.Button(self, id=-1, label="&Login", pos=(225, 135), size=(60, 30))
        self.gauge = wx.Gauge(self, id=-1, pos=(150,150), size=(300, 30))
        self.syncstatusLabel = wx.StaticText(self, id=-1, label="&Sync Status:", pos=(70, 155), size=(85, 20))
        
        self.bigBar = PG.PyGauge(self, -1,pos=(0,25), size=(400, 30), style=wx.GA_HORIZONTAL)
        #self.bigBar.SetValue([100*self.box/self.total, 100*(self.drive+self.box)/self.total, 100*(self.dropbox+self.box+self.drive)/self.total])
        self.bigBar.SetValue(50)
        self.bigBar.SetBarColor([wx.Colour(162, 255, 178), wx.Colour(159, 176, 255), wx.Colour(59, 76, 255)])
        self.bigBar.SetBackgroundColour(wx.WHITE)
        self.bigBar.SetBorderColor(wx.BLACK)
        
        #vbox = wx.BoxSizer(wx.VERTICAL)
        #vbox.Add((-1, 20))
        #hbox4 = wx.BoxSizer(wx.HORIZONTAL)
        self.square1 = PG.PyGauge(self, -1, pos=(50,55), size=(25, 25), style=wx.GA_HORIZONTAL)
        self.square1.SetValue(100)
        self.square1.SetBarColor(wx.Colour(162, 255, 178))
        self.square1.SetBackgroundColour(wx.WHITE)
        self.square1.SetBorderColor(wx.WHITE)
        self.st4 = wx.StaticText(self, pos=(0,55), label=' BOX')
        
        self.square2 = PG.PyGauge(self, -1, pos=(175,55), size=(25, 25), style=wx.GA_HORIZONTAL)
        self.square2.SetValue(100)
        self.square2.SetBarColor(wx.Colour(159, 176, 255))
        self.square2.SetBackgroundColour(wx.WHITE)
        self.square2.SetBorderColor(wx.WHITE)
        self.st5 = wx.StaticText(self, pos=(80,55), label=' Google Drive')
        
        self.square3 = PG.PyGauge(self, -1, pos=(280,55), size=(25, 25), style=wx.GA_HORIZONTAL)
        self.square3.SetValue(100)
        self.square3.SetBarColor(wx.Colour(59, 76, 255))
        self.square3.SetBackgroundColour(wx.WHITE)
        self.square3.SetBorderColor(wx.WHITE)
        self.st6 = wx.StaticText(self, pos=(200,55), label=' Dropbox')

        self.st2 = wx.StaticText(self, pos=(0,95), label='Remaining Storage: ')

        self.gauge.Hide()
        self.syncstatusLabel.Hide()
        self.bigBar.Hide()
        self.square1.Hide()
        self.st4.Hide()
        self.square2.Hide()
        self.st5.Hide()
        self.square3.Hide()
        self.st6.Hide()
        self.st2.Hide()
        
        #Changes background to white
        self.SetBackgroundColour('f0f0f0')
        
        #Adds controls to sizer
        self.sizer2.Add(self.emailLabel, 1, wx.EXPAND)
        self.sizer2.Add(self.emailBox, 1, wx.EXPAND)
        self.sizer2.Add(self.passwordLabel, 1, wx.EXPAND)
        self.sizer2.Add(self.passwordBox, 1, wx.EXPAND)
        self.sizer2.Add(self.apikeyLabel, 1, wx.EXPAND)
        self.sizer2.Add(self.apikeyBox, 1, wx.EXPAND)
        self.sizer2.Add(self.locationLabel, 1, wx.EXPAND)
        self.sizer2.Add(self.pathBox, 1, wx.EXPAND)
        self.sizer2.Add(self.browseButton, 1, wx.EXPAND)
        self.sizer2.Add(self.submitButton, 1, wx.EXPAND)
        
        #Get previous data if any
        self.readSettings()
        
        #Set usage details
        #sizeusedLabel.SetLabel(str( "%.2f" % (sync.loadDirDict(dir, dct)(cloud.authorization,cloud.shareId)/1000000) )+"GB/")
        #sizedleftLabel.SetLabel("GB")
        
        # Use some sizers to see layout options
        self.sizer = wx.BoxSizer(wx.VERTICAL)

        #Layout sizers
        self.SetSizer(self.sizer)
        self.SetAutoLayout(1)
        self.Show()
        
        # Events.
        #while True:
        self.Bind(wx.EVT_BUTTON, self.OnOpen, self.browseButton)
        self.Bind(wx.EVT_MENU, self.OnExit, menuExit)
        self.Bind(wx.EVT_CLOSE, self.OnExit)
        self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout)
        self.Bind(wx.EVT_BUTTON, self.OnSubmit, self.submitButton)
Ejemplo n.º 2
0
    def layout(self):
        """
        Sets up the panel layout for the linear fit including all the
        labels, text entry boxes, and buttons.

        """

        # set up sizers first. 
        # vbox is the panel sizer and is a vertical sizer
        # The first element of the panel is sizer which is a gridbagsizer
        # and contains most of the text fields
        # this is followed by a line separator added to vbox
        # and finally the sizer_button (a horizontal sizer) adds the buttons
        vbox = wx.BoxSizer(wx.VERTICAL)
        sizer = wx.GridBagSizer(5, 5)
        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
        
        #size of string boxes in pixels
        _BOX_WIDTH = 100
        _BOX_HEIGHT = 20
        #now set up all the text fields
        self.tcA = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, _BOX_HEIGHT))
        self.tcA.SetToolTipString("Fit value for the slope parameter.")
        self.tcErrA = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, _BOX_HEIGHT))
        self.tcErrA.SetToolTipString("Error on the slope parameter.")
        self.tcB = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, _BOX_HEIGHT))
        self.tcA.SetToolTipString("Fit value for the constant parameter.")
        self.tcErrB = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, _BOX_HEIGHT))
        self.tcErrB.SetToolTipString("Error on the constant parameter.")
        self.tcChi = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, _BOX_HEIGHT))
        self.tcChi.SetToolTipString("Chi^2 over degrees of freedom.")
        self.xminFit = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, _BOX_HEIGHT))
        msg = "Enter the minimum value on "
        msg += "the x-axis to be included in the fit."
        self.xminFit.SetToolTipString(msg)
        self.xmaxFit = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, _BOX_HEIGHT))
        msg = "Enter the maximum value on "
        msg += " the x-axis to be included in the fit."
        self.xmaxFit.SetToolTipString(msg)
        self.initXmin = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, _BOX_HEIGHT))
        msg = "Minimum value on the x-axis for the plotted data."
        self.initXmin.SetToolTipString(msg)
        self.initXmax = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, _BOX_HEIGHT))
        msg = "Maximum value on the x-axis for the plotted data."
        self.initXmax.SetToolTipString(msg)

        # Make the info box not editable
        # _BACKGROUND_COLOR = '#ffdf85'
        _BACKGROUND_COLOR = self.GetBackgroundColour()
        self.initXmin.SetEditable(False)
        self.initXmin.SetBackgroundColour(_BACKGROUND_COLOR)
        self.initXmax.SetEditable(False)
        self.initXmax.SetBackgroundColour(_BACKGROUND_COLOR)

        #set some flags for specific types of fits like Guinier (Rg) and
        #Porod (bg) -- this will determine WHAT boxes show up in the
        #sizer layout and depends on the active axis transform
        self.bg_on = False
        if RG_ON:
            if (self.yLabel == "ln(y)" or self.yLabel == "ln(y*x)") and \
                    (self.xLabel == "x^(2)"):
                self.rg_on = True
            if (self.xLabel == "x^(4)") and (self.yLabel == "y*x^(4)"):
                self.bg_on = True

        # Finally set up static text strings
        warning = "WARNING! Resolution is NOT accounted for. \n"
        warning += "Thus slit smeared data will give very wrong answers!"
        self.textwarn = wx.StaticText(self, -1, warning)
        self.textwarn.SetForegroundColour(wx.RED)
        explanation = "Perform fit for y(x) = ax + b \n"
        if self.bg_on:
            param_a = 'Background (= Parameter a)'
        else:
            param_a = 'Parameter a'


        #Now set this all up in the GridBagSizer sizer
        ix = 0
        iy = 0
        sizer.Add(self.textwarn, (iy, ix),
                  (2, 3), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
        iy += 2
        sizer.Add(wx.StaticText(self, -1, explanation), (iy, ix),
                  (1, 1), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
        iy += 1
        sizer.Add(wx.StaticText(self, -1, param_a), (iy, ix),
                  (1, 1), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
        ix += 1
        sizer.Add(self.tcA, (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        ix += 1
        sizer.Add(wx.StaticText(self, -1, '+/-'),
                  (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        ix += 1
        sizer.Add(self.tcErrA, (iy, ix), (1, 1),
                  wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        iy += 1
        ix = 0
        sizer.Add(wx.StaticText(self, -1, 'Parameter b'), (iy, ix), (1, 1),
                  wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
        ix += 1
        sizer.Add(self.tcB, (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        ix += 1
        sizer.Add(wx.StaticText(self, -1, '+/-'), (iy, ix),
                  (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        ix += 1
        sizer.Add(self.tcErrB, (iy, ix), (1, 1),
                  wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        iy += 1
        ix = 0
        sizer.Add(wx.StaticText(self, -1, 'Chi2/dof'), (iy, ix), (1, 1),
                  wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
        ix += 1
        sizer.Add(self.tcChi, (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        iy += 2
        ix = 1
        sizer.Add(wx.StaticText(self, -1, 'Min'), (iy, ix), (1, 1),
                  wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        ix += 2
        sizer.Add(wx.StaticText(self, -1, 'Max'), (iy, ix),
                  (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)

        iy += 1
        ix = 0
        sizer.Add(wx.StaticText(self, -1, 'Maximum range (linear scale)'),
                  (iy, ix), (1, 1),
                  wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
        ix += 1
        sizer.Add(self.initXmin, (iy, ix), (1, 1),
                  wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        ix += 2
        sizer.Add(self.initXmax, (iy, ix), (1, 1),
                  wx.EXPAND | wx.ADJUST_MINSIZE, 0)

        iy += 1
        ix = 0
        sizer.Add(wx.StaticText(self, -1, 'Fit range of ' + self.xLabel),
                  (iy, ix), (1, 1),
                  wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
        ix += 1
        sizer.Add(self.xminFit, (iy, ix), (1, 1),
                  wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        ix += 2
        sizer.Add(self.xmaxFit, (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        if self.rg_on:
            self.SetSize((PNL_WIDTH, PNL_HEIGHT))
            I0_stxt = wx.StaticText(self, -1, 'I(q=0)')
            self.I0_tctr = wx.TextCtrl(self, -1, '')
            self.I0_tctr.SetEditable(False)
            self.I0_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
            self.I0err_tctr = wx.TextCtrl(self, -1, '')
            self.I0err_tctr.SetEditable(False)
            self.I0err_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
            Rg_stxt = wx.StaticText(self, -1, 'Rg [A]')
            Rg_stxt.Show(self.yLabel == "ln(y)")
            self.Rg_tctr = wx.TextCtrl(self, -1, '')
            self.Rg_tctr.SetEditable(False)
            self.Rg_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
            self.Rg_tctr.Show(self.yLabel == "ln(y)")
            self.Rgerr_tctr = wx.TextCtrl(self, -1, '')
            self.Rgerr_tctr.SetEditable(False)
            self.Rgerr_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
            self.Rgerr_tctr.Show(self.yLabel == "ln(y)")
            self.Rgerr_pm = wx.StaticText(self, -1, '+/-')
            self.Rgerr_pm.Show(self.yLabel == "ln(y)")
            Diameter_stxt = wx.StaticText(self, -1, 'Rod Diameter [A]')
            Diameter_stxt.Show(self.yLabel == "ln(y*x)")
            self.Diameter_tctr = wx.TextCtrl(self, -1, '')
            self.Diameter_tctr.SetEditable(False)
            self.Diameter_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
            self.Diameter_tctr.Show(self.yLabel == "ln(y*x)")
            self.Diameter_pm = wx.StaticText(self, -1, '+/-')
            self.Diameter_pm.Show(self.yLabel == "ln(y*x)")
            self.Diametererr_tctr = wx.TextCtrl(self, -1, '')
            self.Diametererr_tctr.SetEditable(False)
            self.Diametererr_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
            self.Diametererr_tctr.Show(self.yLabel == "ln(y*x)")
            RgQmin_stxt = wx.StaticText(self, -1, 'Rg*Qmin')
            self.RgQmin_tctr = wx.TextCtrl(self, -1, '')
            self.RgQmin_tctr.SetEditable(False)
            self.RgQmin_tctr.SetBackgroundColour(_BACKGROUND_COLOR)
            RgQmax_stxt = wx.StaticText(self, -1, 'Rg*Qmax')
            self.RgQmax_tctr = wx.TextCtrl(self, -1, '')
            self.RgQmax_tctr.SetEditable(False)
            self.RgQmax_tctr.SetBackgroundColour(_BACKGROUND_COLOR)

            iy += 2
            ix = 0
            sizer.Add(I0_stxt, (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
            ix += 1
            sizer.Add(self.I0_tctr, (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 0)
            ix += 1
            sizer.Add(wx.StaticText(self, -1, '+/-'), (iy, ix),
                      (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
            ix += 1
            sizer.Add(self.I0err_tctr, (iy, ix), (1, 1),
                      wx.EXPAND | wx.ADJUST_MINSIZE, 0)

            iy += 1
            ix = 0
            sizer.Add(Rg_stxt, (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
            ix += 1
            sizer.Add(self.Rg_tctr, (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 0)

            ix += 1
            sizer.Add(self.Rgerr_pm, (iy, ix),
                      (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
            ix += 1
            sizer.Add(self.Rgerr_tctr, (iy, ix), (1, 1),
                      wx.EXPAND | wx.ADJUST_MINSIZE, 0)
            iy += 1
            ix = 0
            sizer.Add(Diameter_stxt, (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
            ix += 1
            sizer.Add(self.Diameter_tctr, (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 0)

            ix += 1
            sizer.Add(self.Diameter_pm, (iy, ix),
                      (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
            ix += 1
            sizer.Add(self.Diametererr_tctr, (iy, ix), (1, 1),
                      wx.EXPAND | wx.ADJUST_MINSIZE, 0)
            iy += 1
            ix = 0
            sizer.Add(RgQmin_stxt, (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
            ix += 1
            sizer.Add(self.RgQmin_tctr, (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 0)
            iy += 1
            ix = 0
            sizer.Add(RgQmax_stxt, (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
            ix += 1
            sizer.Add(self.RgQmax_tctr, (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 0)

        #Now add some space before the separation line
        iy += 1
        ix = 0
        sizer.Add((20,20), (iy, ix), (1, 1),
                      wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 0)

        # Buttons on the bottom
        self.btFit = wx.Button(self, -1, 'Fit')
        self.btFit.Bind(wx.EVT_BUTTON, self._onFit)
        self.btFit.SetToolTipString("Perform fit.")
        self.btClose = wx.Button(self, wx.ID_CANCEL, 'Close')
        self.btClose.Bind(wx.EVT_BUTTON, self._on_close)
        sizer_button.Add((20, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0)
        sizer_button.Add(self.btFit, 0,
                         wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
        sizer_button.Add(self.btClose, 0,
                         wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
        
        vbox.Add(sizer)
        self.static_line_1 = wx.StaticLine(self, -1)        
        vbox.Add(self.static_line_1, 0, wx.EXPAND, 0)
        vbox.Add(sizer_button, 0, wx.EXPAND | wx.BOTTOM | wx.TOP, 10)

        # panel.SetSizer(sizer)
        self.SetSizer(vbox)
        self.Centre()
Ejemplo n.º 3
0
    def __init__(self, *args, **kwds):
        """Initialize the frame and its layout

        """
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        # Top level panels
        left_panel = wx.Panel(self, -1)
        right_panel = wx.Panel(self, -1)
        # Module categories (in left panel)
        module_categories_text = wx.StaticText(left_panel,
                                               -1,
                                               'Module Categories',
                                               style=wx.ALIGN_CENTER)
        font = module_categories_text.GetFont()
        module_categories_text.SetFont(
            wx.Font(font.GetPointSize() * 1.2, font.GetFamily(),
                    font.GetStyle(), wx.FONTWEIGHT_BOLD))
        self.__module_categories_list_box = wx.ListBox(left_panel, -1)
        # Control panel for the selected module
        selected_module_panel = wx.Panel(left_panel, -1)
        selected_module_static_box = wx.StaticBox(selected_module_panel, -1,
                                                  'For Selected Module')
        add_to_pipeline_button = wx.Button(selected_module_panel, -1,
                                           '+ Add to Pipeline')
        module_help_button = wx.Button(selected_module_panel, -1,
                                       '? Module Help')
        # Other buttons
        getting_started_button = wx.Button(left_panel, -1, 'Getting Started')
        done_button = wx.Button(left_panel, -1, 'Done')
        # Right-side panel
        self.__module_list_box = wx.ListBox(right_panel, -1)
        w, h = self.__module_list_box.GetTextExtent(
            "CorrectIllumination_Calculate_Plus")
        self.__module_list_box.SetMinSize(wx.Size(w, h * 30))
        # Sizers
        self.Sizer = wx.BoxSizer(wx.VERTICAL)
        search_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.Sizer.Add(search_sizer, 0, wx.EXPAND | wx.ALL, 2)
        search_sizer.Add(wx.StaticText(self, label="Search:"), 0,
                         wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
        self.search_text = wx.TextCtrl(self)
        search_sizer.Add(self.search_text, 1, wx.EXPAND)
        self.search_button = wx.Button(self, label="Search")
        search_sizer.Add(self.search_button, 0, wx.EXPAND)
        self.Sizer.AddSpacer(2)
        top_sizer = wx.BoxSizer(wx.HORIZONTAL)
        top_sizer.AddMany([(left_panel, 0, wx.EXPAND | wx.LEFT, 5),
                           (right_panel, 1, wx.EXPAND)])
        self.Sizer.Add(top_sizer, 1, wx.EXPAND)
        left_sizer = wx.BoxSizer(wx.VERTICAL)
        left_sizer.Add(module_categories_text, 0, wx.EXPAND)
        left_sizer.AddSpacer(4)
        left_sizer.Add(self.__module_categories_list_box, 1, wx.EXPAND)
        left_sizer.AddSpacer((-1, 10))
        left_sizer.Add(selected_module_panel, 0, wx.EXPAND)
        left_sizer.AddSpacer((-1, 10))
        left_sizer.Add(getting_started_button, 0, wx.EXPAND)
        left_sizer.AddSpacer(2)
        left_sizer.Add(done_button, 0, wx.EXPAND | wx.BOTTOM, 5)
        left_panel.SetSizer(left_sizer)

        right_sizer = wx.BoxSizer(wx.VERTICAL)
        right_sizer.Add(self.__module_list_box, 1, wx.EXPAND | wx.ALL, 5)
        right_panel.SetSizer(right_sizer)

        selected_module_panel_sizer = wx.BoxSizer(wx.VERTICAL)
        selected_module_panel_sizer.Add(add_to_pipeline_button, 0, wx.EXPAND)
        selected_module_panel_sizer.AddSpacer(2)
        selected_module_panel_sizer.Add(module_help_button, 0, wx.EXPAND)
        selected_module_panel.SetSizer(selected_module_panel_sizer)

        self.__set_icon()
        accelerators = wx.AcceleratorTable([
            (wx.ACCEL_CMD, ord('W'), cellprofiler.gui.cpframe.ID_FILE_EXIT)
        ])
        self.SetAcceleratorTable(accelerators)

        self.Bind(wx.EVT_CLOSE, self.__on_close, self)
        self.Bind(wx.EVT_LISTBOX, self.__on_category_selected,
                  self.__module_categories_list_box)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.__on_add_to_pipeline,
                  self.__module_list_box)
        self.Bind(wx.EVT_BUTTON, self.__on_add_to_pipeline,
                  add_to_pipeline_button)
        self.Bind(wx.EVT_BUTTON, self.__on_close, done_button)
        self.Bind(wx.EVT_BUTTON, self.__on_help, module_help_button)
        self.Bind(wx.EVT_BUTTON, self.__on_getting_started,
                  getting_started_button)
        self.Bind(wx.EVT_MENU,
                  self.__on_close,
                  id=cellprofiler.gui.cpframe.ID_FILE_EXIT)
        self.search_button.Bind(wx.EVT_BUTTON, self.__on_search_help)
        self.__get_module_files()
        self.__set_categories()
        self.__listeners = []
        self.__module_categories_list_box.Select(0)
        self.__on_category_selected(None)
        self.Fit()
Ejemplo n.º 4
0
    def __init__(self, parent=None, id=wx.ID_ANY, title='', app=None):
        super(RunnerPanel, self).__init__(
            parent=parent,
            id=id,
            pos=wx.DefaultPosition,
            size=[400, 700],
            style=wx.DEFAULT_FRAME_STYLE,
            name=title,
        )
        ScriptProcess.__init__(self, app)
        self.Bind(wx.EVT_END_PROCESS, self.onProcessEnded)
        #self.SetBackgroundColour(ThemeMixin.appColors['frame_bg'])
        #self.SetForegroundColour(ThemeMixin.appColors['txt_default'])

        # double buffered better rendering except if retina
        self.SetDoubleBuffered(parent.IsDoubleBuffered())

        expCtrlSize = [500, 150]
        ctrlSize = [500, 150]

        self.app = app
        self.prefs = self.app.prefs.coder
        self.paths = self.app.prefs.paths
        self.parent = parent
        self.serverProcess = None

        # self.entries is dict of dicts: {filepath: {'index': listCtrlInd}} and may store ore info later
        self.entries = {}
        self.currentFile = None
        self.currentProject = None  # access from self.currentProject property
        self.currentSelection = None
        self.currentExperiment = None

        # Set ListCtrl for list of tasks
        self.expCtrl = wx.ListCtrl(self,
                                   id=wx.ID_ANY,
                                   size=expCtrlSize,
                                   style=wx.LC_REPORT | wx.BORDER_NONE
                                   | wx.LC_NO_HEADER | wx.LC_SINGLE_SEL)

        self.expCtrl.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onItemSelected,
                          self.expCtrl)
        self.expCtrl.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.onItemDeselected,
                          self.expCtrl)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick, self.expCtrl)
        self.expCtrl.InsertColumn(filenameColumn, _translate('File'))
        self.expCtrl.InsertColumn(folderColumn, _translate('Path'))

        _style = platebtn.PB_STYLE_DROPARROW | platebtn.PB_STYLE_SQUARE
        # Alerts
        self._selectedHiddenAlerts = False  # has user manually hidden alerts?
        self.alertsToggleBtn = PsychopyPlateBtn(self,
                                                -1,
                                                _translate('Alerts'),
                                                style=_style,
                                                name='Alerts')
        # mouse event must be bound like this
        self.alertsToggleBtn.Bind(wx.EVT_LEFT_DOWN, self.setAlertsVisible)
        # mouse event must be bound like this
        self.alertsToggleBtn.Bind(wx.EVT_RIGHT_DOWN, self.setAlertsVisible)
        self.alertsCtrl = StdOutText(parent=self,
                                     size=ctrlSize,
                                     style=wx.TE_READONLY | wx.TE_MULTILINE
                                     | wx.BORDER_NONE)

        self.setAlertsVisible(True)

        # StdOut
        self.stdoutToggleBtn = PsychopyPlateBtn(self,
                                                -1,
                                                _translate('Stdout'),
                                                style=_style,
                                                name='Stdout')
        # mouse event must be bound like this
        self.stdoutToggleBtn.Bind(wx.EVT_LEFT_DOWN, self.setStdoutVisible)
        # mouse event must be bound like this
        self.stdoutToggleBtn.Bind(wx.EVT_RIGHT_DOWN, self.setStdoutVisible)
        self.stdoutCtrl = StdOutText(parent=self,
                                     size=ctrlSize,
                                     style=wx.TE_READONLY | wx.TE_MULTILINE
                                     | wx.BORDER_NONE)
        self.setStdoutVisible(True)

        # Box sizers
        self.upperSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.upperSizer.Add(self.expCtrl, 1, wx.ALL | wx.EXPAND, 5)

        # Set main sizer
        self.mainSizer = wx.BoxSizer(wx.VERTICAL)
        self.mainSizer.Add(self.upperSizer, 0, wx.EXPAND | wx.ALL, 10)
        self.mainSizer.Add(self.alertsToggleBtn, 0, wx.TOP | wx.EXPAND, 10)
        self.mainSizer.Add(self.alertsCtrl, 1, wx.EXPAND | wx.ALL, 10)
        self.mainSizer.Add(self.stdoutToggleBtn, 0, wx.TOP | wx.EXPAND, 10)
        self.mainSizer.Add(self.stdoutCtrl, 1, wx.EXPAND | wx.ALL, 10)

        self.buttonSizer = wx.BoxSizer(wx.VERTICAL)
        self.upperSizer.Add(self.buttonSizer, 0, wx.ALL | wx.EXPAND, 5)
        self.makeButtons()
        self._applyAppTheme()
Ejemplo n.º 5
0
    def __init__(self, parent):
	wx.Dialog.__init__(self,parent,-1, _('Settings'), wx.DefaultPosition)
	self.Centre(wx.BOTH)
	#======================
	box = wx.BoxSizer(wx.VERTICAL)
        
	b1=wx.StaticBoxSizer(wx.StaticBox(self,-1,_('Length of cycle')),wx.VERTICAL)
	i=wx.NewId()
	self.cb1 = wx.CheckBox(self, i, _(' by average'), style=wx.NO_BORDER)
	b1.Add(self.cb1, 0, wx.ALL, 5)
	self.Bind(wx.EVT_CHECKBOX, self.By_Average, id=i)
	self.cb1.SetValue(cycle.by_average)

	b2 = wx.BoxSizer(wx.HORIZONTAL)
	i=wx.NewId()
	self.sc = wx.SpinCtrl(self, i, "", size=wx.Size(50, -1))
        self.sc.SetRange(21,35)
        self.sc.SetValue(cycle.period)
	self.sc.Enable(not self.cb1.GetValue())
	b2.Add(self.sc, 0)
	b2.Add(wx.StaticText(self, -1, _(' days in cycle')), 0)
	b1.Add(b2, 0, wx.ALL, 5)
	box.Add(b1, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 10)
	#======================
	self.rb = wx.RadioBox(self, -1, _('Display'),
	    choices=[_('safe sex days'),_('fertile days'),_('both')],
	    majorDimension=1, style=wx.RA_SPECIFY_COLS)
	box.Add(self.rb, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 10)
	self.rb.SetSelection(cycle.disp)

	#======================
	self.rb1 = wx.RadioBox(self, -1, _('First week day'),
	    choices=[_('monday'),_('sunday')],
	    majorDimension=1, style=wx.RA_SPECIFY_COLS)
	box.Add(self.rb1, 0, wx.EXPAND|wx.ALL, 10)
	self.rb1.SetSelection(cycle.first_week_day)

	#======================
	i=wx.NewId()
	txt1=_('Colours')
	txt2=_('Change password')
	w1,h=self.GetTextExtent(txt1)
	w2,h=self.GetTextExtent(txt2)
	w = max(w1, w2)
	box.Add(wx.Button(self, i, txt1, size=wx.Size(w+10, -1)), 0, wx.ALIGN_CENTER)
	self.Bind(wx.EVT_BUTTON, self.OnColours, id=i)
	#======================
	i=wx.NewId()
	box.Add(wx.Button(self, i, txt2, size=wx.Size(w+10, -1)), 0, wx.TOP|wx.ALIGN_CENTER,10)
	self.Bind(wx.EVT_BUTTON, self.OnChangePasswd, id=i)

	#======================
	but_box=wx.BoxSizer(wx.HORIZONTAL)
	i=wx.NewId()
	but_box.Add(wx.Button(self, i, _('Ok')), 0, wx.ALL, 10)
	self.Bind(wx.EVT_BUTTON, self.OnOk, id=i)
	
	i=wx.NewId()
	but_box.Add(wx.Button(self, i, _('Cancel')), 0, wx.ALL, 10)
	self.Bind(wx.EVT_BUTTON, self.OnCancel, id=i)

	box.Add(but_box, 0, wx.ALIGN_CENTER)

	self.SetAutoLayout(True)
        self.SetSizer(box)
	box.Fit(self)
Ejemplo n.º 6
0
	def __init__(self, toolInfo, speedInfo, parent):
		CNCObject.__init__(self, parent, "contour:polyline")
		self.toolInfo = toolInfo
		
		self.modified = False
		self.unsaved = False
		self.viewTitle = "Polyline %d" % PolyPanel.seqNo
		self.titleText = "G Code Generator: %s" % self.viewTitle
		PolyPanel.seqNo += 1

		wx.Panel.__init__(self, parent, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
		self.Bind(wx.EVT_CLOSE, self.onClose)
		sizer = wx.GridBagSizer(wx.HORIZONTAL)
		sizer.Add(10, 10, wx.GBPosition(0, 4))
		ln = 1
		
		self.setTitleFlag()

		t = wx.StaticText(self, wx.ID_ANY, "Point List")
		sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.tePoints = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_RIGHT + wx.TE_READONLY)
		self.addWidget(self.tePoints, "pointlist")
		sizer.Add(self.tePoints, pos=(ln, 1), span=(1,2), flag=wx.EXPAND, border=10)
		self.bEditPoints = wx.Button(self, wx.ID_ANY, "...", size=(30, 20))
		self.bEditPoints.SetToolTip("Edit Point List")
		
		bsz = wx.BoxSizer(wx.HORIZONTAL)
		bsz.AddSpacer(20)
		bsz.Add(self.bEditPoints)
		
		sizer.Add(bsz, pos=(ln, 3))
		self.Bind(wx.EVT_BUTTON, self.bEditPointsPressed, self.bEditPoints)
		ln += 1
		
		self.cbClosePath = wx.CheckBox(self, wx.ID_ANY, "Close Path")
		self.addWidget(self.cbClosePath, "closepath")
		sizer.Add(self.cbClosePath, pos=(ln, 0), span=(1,4),
				flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_HORIZONTAL, border=5)
		self.Bind(wx.EVT_CHECKBOX, self.onChange, self.cbClosePath)
		ln += 1

		t = wx.StaticText(self, wx.ID_ANY, "Start Z")
		sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.teStartZ = wx.TextCtrl(self, wx.ID_ANY, "0", style=wx.TE_RIGHT)
		self.addWidget(self.teStartZ, "startz")
		sizer.Add(self.teStartZ, pos=(ln, 1), flag=wx.LEFT, border=10)
		
		t = wx.StaticText(self, wx.ID_ANY, "Safe Z above surface")
		sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.teSafeZ = wx.TextCtrl(self, wx.ID_ANY, "0.5", style=wx.TE_RIGHT)
		self.addWidget(self.teSafeZ, "safez")
		sizer.Add(self.teSafeZ, pos=(ln, 3), flag=wx.LEFT, border=10)
		ln += 1

		t = wx.StaticText(self, wx.ID_ANY, "Total Depth")
		sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.teTotalDepth = wx.TextCtrl(self, wx.ID_ANY, "1", style=wx.TE_RIGHT)
		self.addWidget(self.teTotalDepth, "totaldepth")
		sizer.Add(self.teTotalDepth, pos=(ln, 1), flag=wx.LEFT, border=10)
		
		t = wx.StaticText(self, wx.ID_ANY, "Depth/Pass")
		dpp = "%6.3f" % speedInfo["depthperpass"]
		sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.tePassDepth = wx.TextCtrl(self, wx.ID_ANY, dpp, style=wx.TE_RIGHT)
		self.addWidget(self.tePassDepth, "passdepth")
		sizer.Add(self.tePassDepth, pos=(ln, 3), flag=wx.LEFT, border=10)
		ln += 1
		
		self.cbAddSpeed = wx.CheckBox(self, wx.ID_ANY, "Add Speed Parameter")
		self.addWidget(self.cbAddSpeed, "addspeed")
		sizer.Add(self.cbAddSpeed, pos=(ln, 0), span=(1,4),
				flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_HORIZONTAL, border=5)
		self.Bind(wx.EVT_CHECKBOX, self.onCbAddSpeed, self.cbAddSpeed)
		self.cbAddSpeed.SetValue(self.settings.addspeed)
		ln += 1
		
		t = wx.StaticText(self, wx.ID_ANY, "Feed Rate XY (G0)")
		g0xy = "%7.2f" % speedInfo["G0XY"]
		sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.teFeedXYG0 = wx.TextCtrl(self, wx.ID_ANY, g0xy, style=wx.TE_RIGHT)
		self.addWidget(self.teFeedXYG0, "feedXYG0")
		sizer.Add(self.teFeedXYG0, pos=(ln, 1), flag=wx.LEFT, border=10)
		
		t = wx.StaticText(self, wx.ID_ANY, "Feed Rate XY (G1)")
		g1xy = "%7.2f" % speedInfo["G1XY"]
		sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.teFeedXYG1 = wx.TextCtrl(self, wx.ID_ANY, g1xy, style=wx.TE_RIGHT)
		self.addWidget(self.teFeedXYG1, "feedXYG1")
		sizer.Add(self.teFeedXYG1, pos=(ln, 3), flag=wx.LEFT, border=10)
		ln += 1

		t = wx.StaticText(self, wx.ID_ANY, "Feed Rate Z (G0)")
		g0z = "%7.2f" % speedInfo["G0Z"]
		sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.teFeedZG0 = wx.TextCtrl(self, wx.ID_ANY, g0z, style=wx.TE_RIGHT)
		self.addWidget(self.teFeedZG0, "feedZG0")
		sizer.Add(self.teFeedZG0, pos=(ln, 1), flag=wx.LEFT, border=10)
		
		t = wx.StaticText(self, wx.ID_ANY, "Feed Rate Z (G1)")
		g1z = "%7.2f" % speedInfo["G1Z"]
		sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.teFeedZG1 = wx.TextCtrl(self, wx.ID_ANY, g1z, style=wx.TE_RIGHT)
		self.addWidget(self.teFeedZG1, "feedZG1")
		sizer.Add(self.teFeedZG1, pos=(ln, 3), flag=wx.LEFT, border=10)

		self.teFeedXYG0.Enable(self.settings.addspeed)
		self.teFeedXYG1.Enable(self.settings.addspeed)
		self.teFeedZG0.Enable(self.settings.addspeed)
		self.teFeedZG1.Enable(self.settings.addspeed)
		ln += 1

		t = wx.StaticText(self, wx.ID_ANY, "Tool Movement")
		sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		sizer.Add(self.getToolMovement(), pos=(ln, 1), border=5, flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_VERTICAL)	

		t = wx.StaticText(self, wx.ID_ANY, "Tracks")
		sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		
		self.scTracks = wx.SpinCtrl(self, wx.ID_ANY, "", size=(50, -1), style=wx.ALIGN_RIGHT)
		self.addWidget(self.scTracks, "tracks")
		self.scTracks.SetRange(1,20)
		self.scTracks.SetValue(1)
		self.Bind(wx.EVT_SPINCTRL, self.onTracks, self.scTracks)
		sz = wx.BoxSizer(wx.HORIZONTAL)
		sz.AddSpacer(30)
		sz.Add(self.scTracks)
		sizer.Add(sz, pos=(ln, 3), border=5, flag=wx.LEFT+wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_VERTICAL)	

		ln += 1
		t = wx.StaticText(self, wx.ID_ANY, "Tool Diameter")
		td = "%6.3f" % toolInfo["diameter"]
		sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.teToolDiam = wx.TextCtrl(self, wx.ID_ANY, td, style=wx.TE_RIGHT)
		self.addWidget(self.teToolDiam, "tooldiameter")
		sizer.Add(self.teToolDiam, pos=(ln, 1), flag=wx.LEFT, border=10)

		t = wx.StaticText(self, wx.ID_ANY, "Stepover")
		so = "%6.3f" % speedInfo["stepover"]
		sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.teStepOver = wx.TextCtrl(self, wx.ID_ANY, so, style=wx.TE_RIGHT)
		self.addWidget(self.teStepOver, "stepover")
		sizer.Add(self.teStepOver, pos=(ln, 3), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=10)
		ln += 1
		
		t = wx.StaticText(self, wx.ID_ANY, "Measurement System")
		sizer.Add(t, pos=(ln, 0), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		sizer.Add(self.getMeasurementSystem(), pos=(ln, 1), border=5, flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_VERTICAL)	
		
		t = wx.StaticText(self, wx.ID_ANY, "Decimal Places")
		sizer.Add(t, pos=(ln, 2), flag=wx.LEFT+wx.ALIGN_CENTER_VERTICAL, border=20)		
		self.teDecimals = wx.TextCtrl(self, wx.ID_ANY, "4", style=wx.TE_RIGHT)
		self.addWidget(self.teDecimals, "decimals")
		sizer.Add(self.teDecimals, pos=(ln, 3), flag=wx.LEFT, border=10)
		ln += 1

		sizer.Add(20, 20, wx.GBPosition(ln, 0))
		ln += 1
		
		bsz = self.buttons()
		
		sizer.Add(bsz, pos=(ln, 0), span=(1,4),
				flag=wx.TOP+wx.BOTTOM+wx.ALIGN_CENTER_HORIZONTAL, border=5)
		ln += 1
		
		sizer.Add(10, 10, wx.GBPosition(ln, 0))
		ln += 1
		
		self.gcl = GCodeList(self)
		sizer.Add(self.gcl, pos=(ln, 0), span=(1, 4), flag=wx.LEFT+wx.EXPAND, border=10)
		ln += 1
		
		sizer.Add(10, 10, wx.GBPosition(ln, 0))

		self.Bind(wx.EVT_TEXT, self.onChange)
		self.Bind(wx.EVT_RADIOBUTTON, self.onChange)
		
		self.SetSizer(sizer)
		self.Layout()
		self.Fit();
    def __init__(self):

        # Create a map to hold the actuators to control
        self.actuators = []

        # Initialize ROS Node
        rospy.init_node('actuator_array_gui')

        # Get actual remapped node name
        node_name = rospy.get_name()

        # Call base constructor
        wx.Frame.__init__(self,
                          None,
                          wx.ID_ANY,
                          title=node_name,
                          size=(550, 400))

        # Read list of joints to control from Parameter Server
        # The list may be a complex list of structs, or a simple list of joint names
        joints_array = rospy.get_param("~joints")
        for joint in joints_array:
            # Create an ActuatorData structure to hold information about each joint
            actuator = self.ActuatorData()

            # Get the name of the actuator from the "joints" parameter
            if isinstance(joint, str):
                actuator.name = joint
            else:
                actuator.name = joint["name"]

            # Add joint to the list of actuators to control
            self.actuators.append(actuator)

        # Extract joint properties from the robot_description URDF
        robot_description_parameter = rospy.get_param(
            "~robot_description_parameter", "robot_description")
        if len(robot_description_parameter) > 0:
            robot_description_parameter = rospy.resolve_name(
                robot_description_parameter)
            urdf_string = rospy.get_param(robot_description_parameter)
            urdf_doc = parseString(urdf_string)
            joints = urdf_doc.getElementsByTagName("joint")
            for joint in joints:
                name = joint.getAttribute("name")
                indices = [
                    index for index, actuator in enumerate(self.actuators)
                    if actuator.name == name
                ]
                if indices:
                    index = indices[0]
                    limits = joint.getElementsByTagName("limit")
                    for limit in limits:
                        if limit.hasAttribute("lower"):
                            self.actuators[index].min_position = float(
                                limit.getAttribute("lower"))
                        if limit.hasAttribute("upper"):
                            self.actuators[index].max_position = float(
                                limit.getAttribute("upper"))
                        if limit.hasAttribute("velocity"):
                            self.actuators[index].max_velocity = float(
                                limit.getAttribute("velocity"))
                        if limit.hasAttribute("effort"):
                            self.actuators[index].max_effort = float(
                                limit.getAttribute("effort"))

        # Advertise Commands
        self.command_pub = rospy.Publisher("command", JointState)
        self.command_msg = JointState()
        for actuator in self.actuators:
            self.command_msg.name.append(actuator.name)
        self.command_msg.position = [0] * len(self.actuators)
        self.command_msg.velocity = [0] * len(self.actuators)
        self.command_msg.effort = [0] * len(self.actuators)

        # Subscribe to JointStates
        self.joint_state_sub = rospy.Subscriber("joint_states", JointState,
                                                self.joint_states_callback,
                                                None, 1)
        self.joint_state_msg = JointState()
        for actuator in self.actuators:
            self.joint_state_msg.name.append(actuator.name)
        self.joint_state_msg.position = [None] * len(self.actuators)
        self.joint_state_msg.velocity = [None] * len(self.actuators)
        self.joint_state_msg.effort = [None] * len(self.actuators)

        # Create Service Call Proxies
        self.srv_home = rospy.ServiceProxy('home', Empty)
        self.srv_stop = rospy.ServiceProxy('stop', Empty)

        # Update the display every 10th of a second
        self.update_timer = wx.Timer(self, wx.ID_ANY)
        self.Bind(wx.EVT_TIMER, self._on_update_timer, self.update_timer)
        self.update_timer.Start(100, False)

        # Create menu
        self.menubar = wx.MenuBar()
        self.filemenu = wx.Menu()
        self.filemenu.Append(wx.ID_EXIT, 'E&xit', 'Exit the program')
        wx.EVT_MENU(self, wx.ID_EXIT, self.on_exit)
        self.menubar.Append(self.filemenu, '&File')
        self.SetMenuBar(self.menubar)

        # Create main panel
        self.main_panel = wx.Panel(self, wx.ID_ANY)

        # Create panel to hold joint controls
        self.joint_panel = wx.lib.scrolledpanel.ScrolledPanel(
            self.main_panel, wx.ID_ANY)

        joint_panel_sizer = wx.BoxSizer(wx.VERTICAL)
        title_font = wx.Font(pointSize=12,
                             family=wx.DEFAULT,
                             style=wx.NORMAL,
                             weight=wx.BOLD)

        # Create Joint Controls
        self.joint_command_panels = []
        self.joint_status_panels = []
        for actuator in self.actuators:
            # Create label and controls for each joint
            joint_label = wx.StaticText(self.joint_panel, wx.ID_ANY,
                                        actuator.name)
            joint_label.SetFont(title_font)
            joint_command_label = wx.StaticText(self.joint_panel, wx.ID_ANY,
                                                'Command')
            joint_command_panel = JointPanel(
                self.joint_panel,
                joint_name=actuator.name,
                min_position=actuator.min_position,
                max_position=actuator.max_position,
                max_velocity=actuator.max_velocity,
                max_effort=actuator.max_effort,
                input_mode=True)
            joint_status_label = wx.StaticText(self.joint_panel, wx.ID_ANY,
                                               'Status')
            joint_status_panel = JointPanel(self.joint_panel,
                                            joint_name=actuator.name,
                                            min_position=actuator.min_position,
                                            max_position=actuator.max_position,
                                            max_velocity=actuator.max_velocity,
                                            max_effort=actuator.max_effort,
                                            input_mode=False)
            sizer_joint = wx.FlexGridSizer(rows=2, cols=2, vgap=2, hgap=0)
            sizer_joint.SetFlexibleDirection(wx.BOTH)
            sizer_joint.AddGrowableCol(1, 1)
            sizer_joint.Add(joint_command_label, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
            sizer_joint.Add(joint_command_panel, 1, wx.EXPAND)
            sizer_joint.Add(joint_status_label, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
            sizer_joint.Add(joint_status_panel, 1, wx.EXPAND)

            joint_panel_sizer.Add((1, 1), 1, wx.CENTER)
            joint_panel_sizer.Add(joint_label, 0, wx.CENTER | wx.ALL, 5)
            joint_panel_sizer.Add(sizer_joint, 0,
                                  wx.EXPAND | wx.LEFT | wx.RIGHT, 5)

            self.joint_command_panels.append(joint_command_panel)
            self.joint_status_panels.append(joint_status_panel)

        self.joint_panel.SetSizer(joint_panel_sizer)
        self.joint_panel.SetupScrolling()

        # Create panel to hold service buttons, etc
        self.button_panel = wx.Panel(self.main_panel, wx.ID_ANY)

        # Add buttons
        self.home_button = wx.Button(self.button_panel, wx.ID_ANY, 'Home')
        self.stop_button = wx.Button(self.button_panel, wx.ID_ANY, 'Stop')
        self.send_button = wx.Button(self.button_panel, wx.ID_ANY, 'Send')
        self.auto_button = wx.ToggleButton(self.button_panel, wx.ID_ANY,
                                           'Auto Send')

        self.home_button.Bind(wx.EVT_BUTTON, self._on_home_button)
        self.stop_button.Bind(wx.EVT_BUTTON, self._on_stop_button)
        self.send_button.Bind(wx.EVT_BUTTON, self._on_send_button)
        self.auto_button.Bind(wx.EVT_TOGGLEBUTTON, self._on_auto_button)

        # Add to button panel sizer
        button_panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
        button_panel_sizer.Add(self.home_button, 0, wx.CENTER | wx.ALL, 10)
        button_panel_sizer.Add((1, 1), 1, wx.CENTER | wx.ALL, 10)
        button_panel_sizer.Add(self.stop_button, 0, wx.CENTER | wx.ALL, 10)
        button_panel_sizer.Add((1, 1), 1, wx.CENTER | wx.ALL, 10)
        button_panel_sizer.Add(self.send_button, 0, wx.CENTER | wx.ALL, 10)
        button_panel_sizer.Add((1, 1), 1, wx.CENTER | wx.ALL, 10)
        button_panel_sizer.Add(self.auto_button, 0, wx.CENTER | wx.ALL, 10)

        self.button_panel.SetSizer(button_panel_sizer)

        # add the two main panels to a sizer
        main_panel_sizer = wx.BoxSizer(wx.VERTICAL)
        main_panel_sizer.Add(self.joint_panel, 1, wx.EXPAND)
        main_panel_sizer.Add(self.button_panel, 0, wx.EXPAND)
        self.main_panel.SetSizer(main_panel_sizer)
Ejemplo n.º 8
0
    def __init__(self, parent, state):
        wx.Panel.__init__(self, parent)
        self.state = state
        self.img = None
        self.map_img = None
        self.redraw_timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.on_redraw_timer, self.redraw_timer)
        self.Bind(wx.EVT_SET_FOCUS, self.on_focus)
        self.redraw_timer.Start(200)
        self.mouse_pos = None
        self.mouse_down = None
        self.click_pos = None
        self.last_click_pos = None
        if state.elevation:
            self.ElevationMap = mp_elevation.ElevationModel()

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

        # display for lat/lon/elevation
        self.position = wx.TextCtrl(self,
                                    style=wx.TE_MULTILINE | wx.TE_READONLY)
        if os.name == 'nt':
            self.position.SetValue("line 1\nline 2\n")
            size = self.position.GetBestSize()
            self.position.SetMinSize(size)
            self.position.SetValue("")
        else:
            textsize = tuple(
                self.position.GetFullTextExtent('line 1\nline 2\n')[0:2])
            self.position.SetMinSize(textsize)

        self.mainSizer.AddSpacer(2)
        self.mainSizer.Add(self.position,
                           flag=wx.LEFT | wx.BOTTOM | wx.GROW,
                           border=0)
        self.position.Bind(wx.EVT_SET_FOCUS, self.on_focus)

        # a place to put control flags
        self.controls = wx.BoxSizer(wx.HORIZONTAL)
        self.mainSizer.Add(self.controls,
                           0,
                           flag=wx.ALIGN_LEFT | wx.TOP | wx.GROW)
        self.mainSizer.AddSpacer(2)

        # a place to put information like image details
        self.information = wx.BoxSizer(wx.HORIZONTAL)
        self.mainSizer.Add(self.information,
                           0,
                           flag=wx.ALIGN_LEFT | wx.TOP | wx.GROW)
        self.mainSizer.AddSpacer(2)

        # panel for the main map image
        self.imagePanel = mp_widgets.ImagePanel(
            self, wx.EmptyImage(state.width, state.height))
        self.mainSizer.Add(self.imagePanel, flag=wx.GROW, border=5)
        self.imagePanel.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse)
        self.imagePanel.Bind(wx.EVT_KEY_DOWN, self.on_key_down)
        self.imagePanel.Bind(wx.EVT_MOUSEWHEEL, self.on_mouse_wheel)

        # a function to convert from (lat,lon) to (px,py) on the map
        self.pixmapper = functools.partial(self.pixel_coords)

        self.last_view = None
        self.redraw_map()
        state.frame.Fit()
Ejemplo n.º 9
0
 def do_layout(self):
     # start by adding a sizer to self
     self._sizer = wx.BoxSizer()
     self.SetSizer(self._sizer)
     self._sizer.Add((10, 10), wx.SizerFlags(1))
     self._sizer.Add((10, 10), wx.SizerFlags(1))
Ejemplo n.º 10
0
    def __init__(self, parent, log, shellEntity):
        wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize)

        self.shellEntity = shellEntity
        self.parent = parent
        self.log = log
        self.selectedDirectoryItemIndex=-1
        
        self.separator='\\'

        self.directoryFlagList={}

        bSizerMain = wx.BoxSizer(wx.VERTICAL)

        bSizerTop = wx.BoxSizer(wx.HORIZONTAL)

        comboBoxPathChoices = []
        self.comboBoxPath = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,
                                        comboBoxPathChoices, 0)
        bSizerTop.Add(self.comboBoxPath, 1, wx.ALIGN_CENTER_VERTICAL)

        self.buttonRead = wx.Button(self, wx.ID_ANY, u"读取", wx.DefaultPosition, (50,-1), 0)
        bSizerTop.Add(self.buttonRead, 0, wx.ALL, 2)

        bSizerMain.Add(bSizerTop, 0, wx.EXPAND, 5)

        bSizerBottom = wx.BoxSizer(wx.HORIZONTAL)

        bSizerFileTree = wx.BoxSizer(wx.VERTICAL)

        bSizerStatus = wx.BoxSizer(wx.HORIZONTAL)

        self.staticTextHost = wx.StaticText(self, wx.ID_ANY, u" ", wx.DefaultPosition, wx.DefaultSize,
                                              0)
        bSizerStatus.Add(self.staticTextHost, 1, wx.LEFT|wx.EXPAND,5)

        self.staticTextCount = wx.StaticText(self, wx.ID_ANY, u" ", wx.DefaultPosition, wx.DefaultSize, 0)
        bSizerStatus.Add(self.staticTextCount, 1, wx.EXPAND)

        bSizerFileTree.Add(bSizerStatus, 0, wx.EXPAND, 5)

        self.treeCtrlFile = wx.TreeCtrl(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_NO_LINES)
        bSizerFileTree.Add(self.treeCtrlFile, 1, wx.ALL | wx.EXPAND, 5)

        bSizerBottom.Add(bSizerFileTree, 1, wx.EXPAND, 5)

        bSizerDirectoryList = wx.BoxSizer(wx.VERTICAL)

        self.listCtrlDirectory = SortableListCtrl(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT)
        bSizerDirectoryList.Add(self.listCtrlDirectory, 1, wx.ALL | wx.EXPAND, 5)

        bSizerBottom.Add(bSizerDirectoryList, 2, wx.EXPAND, 5)

        bSizerMain.Add(bSizerBottom, 1, wx.EXPAND, 5)

        self.il = wx.ImageList(16, 16)
        self.fileImage = self.il.Add(wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, (16, 16)))
        self.folderImage = self.il.Add(wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, (16,16)))
        self.harddiskImage = self.il.Add(wx.ArtProvider.GetBitmap(wx.ART_HARDDISK, wx.ART_OTHER, (16,16)))

        self.listCtrlDirectory.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
        self.treeCtrlFile.SetImageList(self.il)

        self.listCtrlDirectory.InsertColumn(0, u'名称',width=80)
        self.listCtrlDirectory.InsertColumn(1, u"时间",width=80)
        self.listCtrlDirectory.InsertColumn(2, u"大小",width=80)
        self.listCtrlDirectory.InsertColumn(3, u"属性",width=80)

        self.SetSizer(bSizerMain)

        #windows下第一次点击,会莫名其妙触发两次,暂未定位到问题
        self.treeCtrlFile.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnFileTreeItemClick)

        self.listCtrlDirectory.Bind(wx.EVT_LEFT_DCLICK, self.OnDirectoryItemDoubleClick)
        self.listCtrlDirectory.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnDirectoryItemSelected)
        self.listCtrlDirectory.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnDirectoryItemDeSelected)

        #windows右键
        self.listCtrlDirectory.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnDirectoryItemRightClick)
        #linux右键
        self.listCtrlDirectory.Bind(wx.EVT_RIGHT_UP, self.OnDirectoryItemRightClick)

        self.buttonRead.Bind(wx.EVT_BUTTON,self.OnButtonReadClick)
Ejemplo n.º 11
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.sample_rate_1 = sample_rate_1 = 400000
        self.samp_rate = samp_rate = 400000
        self.gain = gain = 30
        self.freq = freq = 2400000000

        ##################################################
        # Blocks
        ##################################################
        _sample_rate_1_sizer = wx.BoxSizer(wx.VERTICAL)
        self._sample_rate_1_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_sample_rate_1_sizer,
            value=self.sample_rate_1,
            callback=self.set_sample_rate_1,
            label='Sample Rate',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._sample_rate_1_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_sample_rate_1_sizer,
            value=self.sample_rate_1,
            callback=self.set_sample_rate_1,
            minimum=0,
            maximum=20000000,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_sample_rate_1_sizer)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label='Gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=90,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_gain_sizer)
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            label='freq',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            minimum=2399999999,
            maximum=2500000000,
            num_steps=1,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=1000000000,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(("serial=F5EAC0", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(sample_rate_1)
        self.uhd_usrp_sink_0.set_center_freq(freq, 0)
        self.uhd_usrp_sink_0.set_gain(gain, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.analog_fastnoise_source_x_0 = analog.fastnoise_source_c(
            analog.GR_GAUSSIAN, 1, 0, 8192)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.wxgui_fftsink2_0, 0))
Ejemplo n.º 12
0
    def __init__(self, parent, missionoptions):
        self.missionoptions = missionoptions
        self.parent = parent

        wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent)

        self.mainbox = wx.FlexGridSizer(30,2,5,5)

        self.lblprint_only_non_default_options = wx.StaticText(self, -1, "Print only non-default options to .emtgopt file?")
        self.chkprint_only_non_default_options = wx.CheckBox(self, -1)
        
        self.lbloutput_file_frame = wx.StaticText(self, -1, "Output file frame")
        output_file_frame_choices = ['ICRF', 'J2000_BCI', 'J2000_BCF', 'TrueOfDate_BCI', 'TrueOfDate_BCF', 'Principle Axes', 'Topocentric', 'Polar']
        self.cmboutput_file_frame = wx.ComboBox(self, -1, style=wx.CB_READONLY, choices=output_file_frame_choices)

        self.lbloutput_dormant_journeys = wx.StaticText(self, -1, "Output journey entries for wait times at intermediate and final target?")
        self.chkoutput_dormant_journeys = wx.CheckBox(self, -1)

        self.lblpost_mission_wait_time = wx.StaticText(self, -1, "Stay time at the final target")
        self.txtpost_mission_wait_time = wx.TextCtrl(self, -1, "post_mission_wait_time")

        self.lbloverride_working_directory = wx.StaticText(self, -1, "Override working directory?")
        self.chkoverride_working_directory = wx.CheckBox(self, -1)

        self.lblforced_working_directory = wx.StaticText(self, -1, "Working directory")
        self.txtforced_working_directory = wx.TextCtrl(self, -1, "forced_working_directory", size=(600,-1))
        self.btnforced_working_directory = wx.Button(self, -1, "...")
        working_directory_sizer = wx.BoxSizer(wx.HORIZONTAL)
        working_directory_sizer.AddMany([self.txtforced_working_directory, self.btnforced_working_directory])

        self.lbloverride_mission_subfolder = wx.StaticText(self, -1, "Override mission_subfolder?")
        self.chkoverride_mission_subfolder = wx.CheckBox(self, -1)

        self.lblforced_mission_subfolder = wx.StaticText(self, -1, "Mission Subfolder")
        self.txtforced_mission_subfolder = wx.TextCtrl(self, -1, "forced_mission_subfolder", size=(600,-1))
        self.btnforced_mission_subfolder = wx.Button(self, -1, "...")
        mission_subfolder_sizer = wx.BoxSizer(wx.HORIZONTAL)
        mission_subfolder_sizer.AddMany([self.txtforced_mission_subfolder, self.btnforced_mission_subfolder])

        self.lblshort_output_file_names = wx.StaticText(self, -1, "Shorten output file names?")
        self.chkshort_output_file_names = wx.CheckBox(self, -1)

        self.lblgenerate_forward_integrated_ephemeris = wx.StaticText(self, -1, "Generate forward-integrated ephemeris")
        self.chkgenerate_forward_integrated_ephemeris = wx.CheckBox(self, -1)

        self.lblforward_integrated_ephemeris_central_body_SPICE_ID = wx.StaticText(self, -1, "SPICE ID of central body for forward integrated ephemeris")
        self.txtforward_integrated_ephemeris_central_body_SPICE_ID = wx.TextCtrl(self, -1, "forward_integrated_ephemeris_central_body_SPICE_ID")

        self.lbladd_control_switch_line_to_ephemeris = wx.StaticText(self, -1, "Add duplicate control switch lines to ephemeris?")
        self.chkadd_control_switch_line_to_ephemeris = wx.CheckBox(self, -1)

        self.lblappend_mass_to_ephemeris_output = wx.StaticText(self, -1, "Append mass to forward integrated ephemeris?")
        self.chkappend_mass_to_ephemeris_output = wx.CheckBox(self, -1)

        self.lblappend_control_to_ephemeris_output = wx.StaticText(self, -1, "Append control to forward integrated ephemeris?")
        self.chkappend_control_to_ephemeris_output = wx.CheckBox(self, -1)
        
        self.lblappend_thrust_to_ephemeris_output = wx.StaticText(self, -1, "Append thrust to forward integrated ephemeris?")
        self.chkappend_thrust_to_ephemeris_output = wx.CheckBox(self, -1)

        self.lblappend_mdot_to_ephemeris_output = wx.StaticText(self, -1, "Append mass flow rate to forward integrated ephemeris?")
        self.chkappend_mdot_to_ephemeris_output = wx.CheckBox(self, -1)

        self.lblappend_Isp_to_ephemeris_output = wx.StaticText(self, -1, "Append Isp to forward integrated ephemeris?")
        self.chkappend_Isp_to_ephemeris_output = wx.CheckBox(self, -1)

        self.lblappend_number_of_active_engines_to_ephemeris_output = wx.StaticText(self, -1, "Append number of active engines to forward integrated ephemeris?")
        self.chkappend_number_of_active_engines_to_ephemeris_output = wx.CheckBox(self, -1)
        
        self.lblappend_throttle_level_to_ephemeris_output = wx.StaticText(self, -1, "Append throttle level to forward integrated ephemeris?")
        self.chkappend_throttle_level_to_ephemeris_output = wx.CheckBox(self, -1)         
        
        self.lblappend_active_power_to_ephemeris_output = wx.StaticText(self, -1, "Append active_power to forward integrated ephemeris?")
        self.chkappend_active_power_to_ephemeris_output = wx.CheckBox(self, -1)
        
        self.lblspacecraft_SPICE_ID = wx.StaticText(self, -1, "Spacecraft SPICE ID")
        self.txtspacecraft_SPICE_ID = wx.TextCtrl(self, -1, "spacecraft_SPICE_ID", size=(300,-1))
        
        self.lblpyemtg_path = wx.StaticText(self, -1, "Path to PyEMTG")
        self.txtpyemtg_path = wx.TextCtrl(self, -1, "pyemtg_path", size=(600,-1))
        self.btnpyemtg_path = wx.Button(self, -1, "...")
        PyEMTG_path_sizer = wx.BoxSizer(wx.HORIZONTAL)
        PyEMTG_path_sizer.AddMany([self.txtpyemtg_path, self.btnpyemtg_path])
        
        self.lblspice_utility_extension = wx.StaticText(self, -1, "File extension for SPICE utilities")
        self.txtspice_utility_extension = wx.TextCtrl(self, -1, "spice_utility_extension", size=(300,-1))      
                
        self.lblspice_utilities_path = wx.StaticText(self, -1, "Path to SPICE utilities (brief, mkspk, etc.)")
        self.txtspice_utilities_path = wx.TextCtrl(self, -1, "spice_utilities_path", size=(600,-1))
        self.btnspice_utilities_path = wx.Button(self, -1, "...")
        spice_utilities_path_sizer = wx.BoxSizer(wx.HORIZONTAL)
        spice_utilities_path_sizer.AddMany([self.txtspice_utilities_path, self.btnspice_utilities_path])  

        self.lblcall_system_to_generate_bsp = wx.StaticText(self, -1, "Perform a system call to write a binary SPICE kernel?")
        self.chkcall_system_to_generate_bsp = wx.CheckBox(self, -1)
        
        self.lblbackground_mode = wx.StaticText(self, -1, "Enable background mode")
        self.chkbackground_mode = wx.CheckBox(self, -1)

        self.lbloutput_STMs = wx.StaticText(self, -1, "Write STMs?")
        self.chkoutput_STMs = wx.CheckBox(self, -1)

        self.lbloutput_maneuver_and_target_spec_files = wx.StaticText(self, -1, "Write maneuver and target spec files?")
        self.chkoutput_maneuver_and_target_spec_files = wx.CheckBox(self, -1)

        self.mainbox.AddMany([  self.lblprint_only_non_default_options, self.chkprint_only_non_default_options,
                                self.lbloutput_file_frame, self.cmboutput_file_frame,
                                self.lbloutput_dormant_journeys, self.chkoutput_dormant_journeys,
                                self.lblpost_mission_wait_time, self.txtpost_mission_wait_time,
                                self.lbloverride_working_directory, self.chkoverride_working_directory,
                                self.lblforced_working_directory, working_directory_sizer,
                                self.lbloverride_mission_subfolder, self.chkoverride_mission_subfolder,
                                self.lblforced_mission_subfolder, mission_subfolder_sizer,
                                self.lblshort_output_file_names, self.chkshort_output_file_names,
                                self.lblgenerate_forward_integrated_ephemeris, self.chkgenerate_forward_integrated_ephemeris,
                                self.lblforward_integrated_ephemeris_central_body_SPICE_ID, self.txtforward_integrated_ephemeris_central_body_SPICE_ID,
                                self.lbladd_control_switch_line_to_ephemeris, self.chkadd_control_switch_line_to_ephemeris,
                                self.lblappend_mass_to_ephemeris_output, self.chkappend_mass_to_ephemeris_output,
                                self.lblappend_control_to_ephemeris_output, self.chkappend_control_to_ephemeris_output,
                                self.lblappend_thrust_to_ephemeris_output, self.chkappend_thrust_to_ephemeris_output,
                                self.lblappend_mdot_to_ephemeris_output, self.chkappend_mdot_to_ephemeris_output,
                                self.lblappend_Isp_to_ephemeris_output, self.chkappend_Isp_to_ephemeris_output,
                                self.lblappend_number_of_active_engines_to_ephemeris_output, self.chkappend_number_of_active_engines_to_ephemeris_output,
                                self.lblappend_active_power_to_ephemeris_output, self.chkappend_active_power_to_ephemeris_output,
                                self.lblappend_throttle_level_to_ephemeris_output, self.chkappend_throttle_level_to_ephemeris_output,
                                self.lblspacecraft_SPICE_ID, self.txtspacecraft_SPICE_ID,
                                self.lblpyemtg_path, PyEMTG_path_sizer,
                                self.lblspice_utilities_path, spice_utilities_path_sizer,
                                self.lblspice_utility_extension, self.txtspice_utility_extension,
                                self.lblcall_system_to_generate_bsp, self.chkcall_system_to_generate_bsp,
                                self.lbloutput_STMs, self.chkoutput_STMs,
                                self.lbloutput_maneuver_and_target_spec_files, self.chkoutput_maneuver_and_target_spec_files,
                                self.lblbackground_mode, self.chkbackground_mode])
        
        self.presentbox = wx.FlexGridSizer(1,2,5,5)
        self.presentbox.AddMany([self.mainbox])

        self.SetSizer(self.presentbox)
        self.SetupScrolling()

        #bindings
        self.chkprint_only_non_default_options.Bind(wx.EVT_CHECKBOX, self.Changeprint_only_non_default_options)
        self.cmboutput_file_frame.Bind(wx.EVT_COMBOBOX, self.Changeoutput_file_frame)
        self.chkoutput_dormant_journeys.Bind(wx.EVT_CHECKBOX, self.Changeoutput_dormant_journeys)
        self.txtpost_mission_wait_time.Bind(wx.EVT_KILL_FOCUS, self.Changepost_mission_wait_time)
        self.chkoverride_working_directory.Bind(wx.EVT_CHECKBOX, self.Changeoverride_working_directory)
        self.txtforced_working_directory.Bind(wx.EVT_KILL_FOCUS, self.Changeforced_working_directory)
        self.btnforced_working_directory.Bind(wx.EVT_BUTTON, self.Clickforced_working_directory_button)
        self.chkoverride_mission_subfolder.Bind(wx.EVT_CHECKBOX, self.Changeoverride_mission_subfolder)
        self.txtforced_mission_subfolder.Bind(wx.EVT_KILL_FOCUS, self.Changeforced_mission_subfolder)
        self.btnforced_mission_subfolder.Bind(wx.EVT_BUTTON, self.Clickforced_mission_subfolder_button)
        self.chkshort_output_file_names.Bind(wx.EVT_CHECKBOX, self.Changeshort_output_file_names)
        self.chkgenerate_forward_integrated_ephemeris.Bind(wx.EVT_CHECKBOX, self.Changegenerate_forward_integrated_ephemeris)
        self.txtforward_integrated_ephemeris_central_body_SPICE_ID.Bind(wx.EVT_KILL_FOCUS, self.Changeforward_integrated_ephemeris_central_body_SPICE_ID)
        self.chkadd_control_switch_line_to_ephemeris.Bind(wx.EVT_CHECKBOX, self.Changeadd_control_switch_line_to_ephemeris)
        self.chkappend_mass_to_ephemeris_output.Bind(wx.EVT_CHECKBOX, self.Changeappend_mass_to_ephemeris_output)
        self.chkappend_control_to_ephemeris_output.Bind(wx.EVT_CHECKBOX, self.Changeappend_control_to_ephemeris_output)
        self.chkappend_thrust_to_ephemeris_output.Bind(wx.EVT_CHECKBOX, self.Changeappend_thrust_to_ephemeris_output)
        self.chkappend_mdot_to_ephemeris_output.Bind(wx.EVT_CHECKBOX, self.Changeappend_mdot_to_ephemeris_output)
        self.chkappend_Isp_to_ephemeris_output.Bind(wx.EVT_CHECKBOX, self.Changeappend_Isp_to_ephemeris_output)
        self.chkappend_number_of_active_engines_to_ephemeris_output.Bind(wx.EVT_CHECKBOX, self.Changeappend_number_of_active_engines_to_ephemeris_output)
        self.chkappend_active_power_to_ephemeris_output.Bind(wx.EVT_CHECKBOX, self.Changeappend_active_power_to_ephemeris_output)
        self.chkappend_throttle_level_to_ephemeris_output.Bind(wx.EVT_CHECKBOX, self.Changeappend_throttle_level_to_ephemeris_output)

        self.txtspacecraft_SPICE_ID.Bind(wx.EVT_KILL_FOCUS, self.Changespacecraft_SPICE_ID)
        self.txtpyemtg_path.Bind(wx.EVT_KILL_FOCUS, self.Changepyemtg_path)
        self.btnpyemtg_path.Bind(wx.EVT_BUTTON, self.Clickpyemtg_path_button)
        self.txtspice_utility_extension.Bind(wx.EVT_KILL_FOCUS, self.Changespice_utility_extension)
        self.txtspice_utilities_path.Bind(wx.EVT_KILL_FOCUS, self.Changespice_utilities_path)
        self.btnspice_utilities_path.Bind(wx.EVT_BUTTON, self.Clickspice_utilities_path_button)
        self.chkcall_system_to_generate_bsp.Bind(wx.EVT_CHECKBOX, self.Changecall_system_to_generate_bsp)

        self.chkoutput_STMs.Bind(wx.EVT_CHECKBOX, self.Changeoutput_STMs)
        self.chkoutput_maneuver_and_target_spec_files.Bind(wx.EVT_CHECKBOX, self.Changeoutput_maneuver_and_target_spec_files)
        self.chkbackground_mode.Bind(wx.EVT_CHECKBOX, self.Changebackground_mode)
Ejemplo n.º 13
0
    def doLayout(self):
        # A horizontal BoxSizer will contain the GridSizer (on the left)
        # and the logger text control (on the right):
        boxSizer = wx.BoxSizer(orient=wx.HORIZONTAL)
        # A GridSizer will contain the other controls:
        gridSizer = wx.FlexGridSizer(rows=20, cols=2, vgap=10, hgap=10)

        # Prepare some reusable arguments for calling sizer.Add():
        expandOption = dict(flag=wx.EXPAND)
        noOptions = dict()
        emptySpace = ((0, 0), noOptions)
        """
                 # section 3
                 (self.selectfilterLabel, noOptions),
                 (self.selectfilterComboBox, expandOption),
                 (self.selectlengthLabel, noOptions),
                 (self.selectlengthComboBox, expandOption),
                  emptySpace,
                 (self.filterButton, dict(flag=wx.ALIGN_CENTER)),
                  emptySpace,
                  emptySpace,
                 # end
        """
        # Add the controls to the sizers:
        for control, options in \
                [(self.head1Label, noOptions),
                  emptySpace,
                 (self.derivativeButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.fitButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.rotationButton, dict(flag=wx.ALIGN_CENTER)),
                  emptySpace,
                 (self.head2Label, noOptions),
                  emptySpace,
                 (self.maxButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.minButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.meanButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.flagmodButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.head3Label, noOptions),
                  emptySpace,
                 (self.filterButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.smoothButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.offsetButton, dict(flag=wx.ALIGN_CENTER)),
                  emptySpace,
                 (self.head4Label, noOptions),
                  emptySpace,
                 (self.deltafButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.baselineButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.activityButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.calcfButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.head5Label, noOptions),
                  emptySpace,
                 (self.powerButton, dict(flag=wx.ALIGN_CENTER)),
                 (self.spectrumButton, dict(flag=wx.ALIGN_CENTER)),
                  emptySpace,
                  emptySpace]:
            gridSizer.Add(control, **options)

        for control, options in \
                [(gridSizer, dict(border=5, flag=wx.ALL))]:
            boxSizer.Add(control, **options)

        self.SetSizerAndFit(boxSizer)
Ejemplo n.º 14
0
    def __init__(self,
                 parent,
                 ID,
                 title,
                 size=wx.DefaultSize,
                 pos=wx.DefaultPosition,
                 style=wx.DEFAULT_DIALOG_STYLE,
                 data={"flag": "new"}):

        wx.Dialog.__init__(self)
        self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
        self.Create(parent, ID, title, pos, size, style)

        #self.PostCreate(self)

        sizer = wx.BoxSizer(wx.VERTICAL)

        label = wx.StaticText(self, -1, "Rule")
        sizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        box1 = wx.BoxSizer(wx.HORIZONTAL)
        label1 = wx.StaticText(self, -1, "RuleName:", size=(80, -1))
        label1.SetForegroundColour((255, 0, 0))
        box1.Add(label1, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        self.textRN = wx.TextCtrl(self, -1, "", size=(180, -1))
        box1.Add(self.textRN, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
        #sizer.Add(box1, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        box2 = wx.BoxSizer(wx.HORIZONTAL)
        label2 = wx.StaticText(self, -1, "RuleType:", size=(80, -1))
        label2.SetForegroundColour((255, 0, 0))
        box2.Add(label2, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        self.choiceRT = wx.Choice(self, -1, (100, 50), choices=choiceRTList)
        self.Bind(wx.EVT_CHOICE, self.OnEvtChoiceRT, self.choiceRT)
        box2.Add(self.choiceRT, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
        #sizer.Add(box2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        box3 = wx.BoxSizer(wx.HORIZONTAL)
        self.label3 = wx.StaticText(self, -1, "LookField:", size=(80, -1))
        box3.Add(self.label3, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        self.textLF = wx.TextCtrl(self, -1, "", size=(180, -1))
        box3.Add(self.textLF, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
        #sizer.Add(box3, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        box4 = wx.BoxSizer(wx.HORIZONTAL)
        self.label4 = wx.StaticText(self, -1, "LookupObject:", size=(80, -1))
        box4.Add(self.label4, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        self.textLO = wx.TextCtrl(self, -1, "", size=(180, -1))
        box4.Add(self.textLO, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
        #sizer.Add(box4, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        box5 = wx.BoxSizer(wx.HORIZONTAL)
        label5 = wx.StaticText(self, -1, "OutField:", size=(80, -1))
        label5.SetForegroundColour((255, 0, 0))
        box5.Add(label5, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        self.textOF = wx.TextCtrl(self, -1, "", size=(180, -1))
        box5.Add(self.textOF, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
        #sizer.Add(box5, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        box6 = wx.BoxSizer(wx.HORIZONTAL)
        label6 = wx.StaticText(self, -1, "Where:", size=(80, -1))
        box6.Add(label6, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        self.textWH = wx.TextCtrl(self, -1, "", size=(180, -1))
        box6.Add(self.textWH, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
        #sizer.Add(box6, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        box7 = wx.BoxSizer(wx.HORIZONTAL)
        label7 = wx.StaticText(self, -1, "Condition:", size=(80, -1))
        label7.SetForegroundColour((255, 0, 0))
        box7.Add(label7, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        self.textCD = wx.TextCtrl(self, -1, "", size=(180, -1))
        box7.Add(self.textCD, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
        #sizer.Add(box7, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
        #sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5)

        btnsizer = wx.StdDialogButtonSizer()

        if wx.Platform != "__WXMSW__":
            btn = wx.ContextHelpButton(self)
            btnsizer.AddButton(btn)

        btnSave = wx.Button(self, wx.ID_SAVE)
        btnSave.SetHelpText("The OK button completes the dialog")
        btnSave.SetDefault()
        self.Bind(wx.EVT_BUTTON, self.OnEvtButtonSave, btnSave)
        btnsizer.AddButton(btnSave)

        btnCancel = wx.Button(self, wx.ID_CANCEL)
        btnCancel.SetHelpText(
            "The Cancel button cancels the dialog. (Cool, huh?)")
        btnsizer.AddButton(btnCancel)
        btnsizer.Realize()

        #sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        self.SetSizer(sizer)
        sizer.Fit(self)

        if data["flag"] == "edit":
            self.textRN.SetValue(data["rule_name"])
            self.choiceRT.SetSelection(choiceRTList.index(data["rule_type"]))
            if data["rule_type"] == "function":
                self.label3.SetForegroundColour((0, 0, 0))
                self.label4.SetForegroundColour((0, 0, 0))
                self.textLF.SetEditable(False)
                self.textLO.SetEditable(False)
                self.textWH.SetEditable(False)
            if data["rule_type"] == "lookup":
                self.label3.SetForegroundColour((255, 0, 0))
                self.label4.SetForegroundColour((255, 0, 0))
            self.textLF.SetValue(data["look_field"])
            self.textLO.SetValue(data["lookup_object"])
            self.textOF.SetValue(data["out_field"])
            self.textWH.SetValue(data["where_c"])
            self.textCD.SetValue(data["condition"])
Ejemplo n.º 15
0
    def __init__(self, parent, frame):
        ScrolledPanel.__init__(self, parent, -1)
        self.frame = frame
        self.parent = parent

        self.SetupScrolling(scroll_y=True, scroll_x=True)

        ## draw event selection tools
        # dropdown for plot selection
        self.WXCB_plot = wx.ComboBox(self,
                                     style=wx.CB_DROPDOWN|wx.CB_READONLY,
                                     size=(250,-1))
        # spin control for event selection
        self.WXSP_plot = wx.SpinCtrl(self, min=1, max=10000000)
        
        ctrlsizer = wx.BoxSizer(wx.HORIZONTAL)
        ctrlsizer.Add(wx.StaticText(self, label="Event:"),0, wx.ALIGN_CENTER)
        ctrlsizer.Add(self.WXCB_plot)
        ctrlsizer.Add(self.WXSP_plot)

        # Bindings
        self.Bind(wx.EVT_COMBOBOX, self.OnShowEvent, self.WXCB_plot)
        self.Bind(wx.EVT_SPINCTRL, self.OnShowEvent, self.WXSP_plot)
        
        ## Image panel with chaco don't work. I get a segmentation fault
        ## with Ubuntu 14.04
        ##
        ## See the bug at launchpad
        ## https://bugs.launchpad.net/ubuntu/+source/python-chaco/+bug/1145575
        #self.plot_window = ea.Window(self)
        #self.vbox = wx.BoxSizer(wx.VERTICAL)
        #self.vbox.Add(self.plot_window.control, 1, wx.EXPAND)
        #self.SetSizer(self.vbox)
        #self.vbox.Fit(self)
        #self.pd = ca.ArrayPlotData()
        #x = np.arange(100).reshape(10,10)
        #a = ca.ImageData()
        #a.set_data(x)
        #self.pd.set_data("cellimg", a)
        #implot = ca.Plot(self.pd)
        #implot.img_plot("cellimg")
        #container = ca.GridPlotContainer(
        #                              shape = (1,1),
        #                              spacing = (0,0),
        #                              padding = (0,0,0,0),
        #                              valign = 'top',
        #                              bgcolor = 'white',
        #                              fill_padding = True,
        #                              use_backbuffer = True)
        #container.add(implot)
        # CAUSE SEGMENTATION FAULT
        #self.plot_window.component = container
        #self.plot_window.redraw()

        # Draw image with wxPython instead
        self.startSizeX = 250
        self.startSizeY = 77
        self.img = wx.EmptyImage(self.startSizeX, self.startSizeY)
        self.imageCtrl = wx.StaticBitmap(self, wx.ID_ANY, 
                                         wx.BitmapFromImage(self.img))
        #self.mainSizer = wx.BoxSizer(wx.VERTICAL|wx.ALIGN_TOP|wx.ALIGN_LEFT)
        #self.mainSizer.Add(self.imageCtrl, 1, wx.ALIGN_TOP|wx.ALIGN_LEFT)
        #self.SetSizer(self.mainSizer)
        #self.mainSizer.Fit(self)
        self.PlotImage()

        ## draw manual filtering options
        self.WXChB_exclude = wx.CheckBox(self, label="Exclude event")
        exclsizer = wx.BoxSizer(wx.HORIZONTAL)
        exclsizer.Add(self.WXChB_exclude, 0, wx.ALIGN_CENTER_VERTICAL)
        self.Bind(wx.EVT_CHECKBOX, self.OnChBoxExclude, self.WXChB_exclude)

        # Update Plot button
        updbutton = wx.Button(self, label="Update plot")
        self.Bind(wx.EVT_BUTTON, self.OnUpdatePlot, updbutton)

        #exclsizer.AddSpacer(self.imageCtrl.GetSize()[0]-updbutton.GetSize()[0]-self.WXChB_exclude.GetSize()[0])        
        exclsizer.Add(updbutton, 0, wx.ALIGN_RIGHT)
        
        ## Add traces plot
        # set initial values
        x = np.linspace(-np.pi, np.pi, 50)
        y = np.cos(x)+1
        plotkwargs = {}
        for trid in dclab.definitions.FLUOR_TRACES:
            plotkwargs[trid] = y
        
        self.trace_data = ca.ArrayPlotData(x=x, **plotkwargs)

        self.trace_plot = ca.Plot(self.trace_data,
                                  padding=0,
                                  spacing=0)

        for trid in dclab.definitions.FLUOR_TRACES:
            if trid.count("raw"):
                color = "gray"
            elif trid == "fl1_median":
                color = "green"
            elif trid == "fl2_median":
                color = "orange"
            elif trid == "fl3_median":
                color = "red"
            self.trace_plot.plot(("x", trid), type="line", color=color)
        
        # convert wx color to something chaco understands
        bgcolor = list(np.array(self.GetBackgroundColour()) / 255)
        container = ca.HPlotContainer(spacing=70,
                                      padding=50,
                                      bgcolor=bgcolor,
                                      fill_padding=True,)#)
        container.add(self.trace_plot)
        
        self.plot_window = Window(self, component=container)

        sizer = wx.GridBagSizer(5,5)
        sizer.Add(ctrlsizer, (0,0))
        sizer.Add(self.imageCtrl, (1,0))
        sizer.Add(exclsizer, (2,0))
        self.plot_window.control.SetMinSize((300, 300))
        sizer.Add(self.plot_window.control, (3,0), span=(2,2), flag=wx.EXPAND)

        self.SetSizer(sizer)
        sizer.Fit(self)
        self.sizer = sizer
    def __init__( self, parent ):
      wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Attendance", pos = wx.DefaultPosition, size = wx.Size( 700,600 ), style = wx.DEFAULT_FRAME_STYLE|wx.SYSTEM_MENU|wx.TAB_TRAVERSAL )
        
      self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
      self.SetBackgroundColour(wx.Colour(52,203,142))
      bSizer1 = wx.BoxSizer( wx.VERTICAL )
        
      bSizer5 = wx.BoxSizer( wx.VERTICAL )
        
      self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Attendance", wx.DefaultPosition, wx.DefaultSize, 0 )
      self.m_staticText1.Wrap( -1 )
      self.m_staticText1.SetFont( wx.Font( 20, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_BOLD, False, "Elephant" ) )
      self.m_staticText1.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWFRAME ) )
       
      bSizer5.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
      
      bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
        
      bSizer7 = wx.BoxSizer( wx.VERTICAL )
        
      bSizer16 = wx.BoxSizer( wx.VERTICAL )
        
      self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.Size(20,20), wx.TAB_TRAVERSAL )
      self.m_panel1.SetBackgroundColour(wx.Colour(52,203,142))
      bSizer16.Add( self.m_panel1, 1, wx.ALL, 5 )
      
      bSizer7.Add( bSizer16, 1, wx.EXPAND, 5 )
        
      bSizer11 = wx.BoxSizer( wx.HORIZONTAL )
      bSizer8 = wx.BoxSizer( wx.VERTICAL )    

      bSizer8 = wx.BoxSizer( wx.VERTICAL )
        
      bSizer9 = wx.BoxSizer( wx.HORIZONTAL )
        
      self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Search by date :",wx.DefaultPosition, wx.DefaultSize, 0 )
      self.m_staticText2.Wrap( -1 )
      self.m_staticText2.SetFont( wx.Font( 12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) )
        
      bSizer9.Add( self.m_staticText2, 0, wx.ALIGN_TOP|wx.ALL, 5 )
        
      self.txtSearch = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 120,-1 ), 0 )
      self.txtSearch.SetFont( wx.Font( 10, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) )
        
      bSizer9.Add( self.txtSearch, 0, wx.ALIGN_TOP|wx.ALL, 5 )
        
      self.btnSearch = wx.Button( self, wx.ID_ANY, u"Search", wx.DefaultPosition, wx.Size( 120,28 ), 0 )
      self.btnSearch.SetFont( wx.Font( 10, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) )
      self.btnSearch.SetBackgroundColour(wx.Colour(178,178,178))
        
      bSizer9.Add( self.btnSearch, 0, wx.ALIGN_TOP|wx.ALL, 5 )
             
      bSizer8.Add( bSizer9, 1, wx.EXPAND, 5 )
      self.btnBack = wx.Button( self, wx.ID_ANY, u"Back", wx.DefaultPosition, wx.Size( 120,28 ), 0 )
      self.btnBack.SetFont( wx.Font( 10, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) )
      self.btnBack.SetBackgroundColour( wx.Colour(178,178,178) )
        
      bSizer9.Add( self.btnBack, 0, wx.ALIGN_TOP|wx.ALL, 5 )
      self.btnBack.Bind(wx.EVT_BUTTON, self.btnBackClick)
      self.btnSearch.Bind( wx.EVT_BUTTON, self.btnSearchClick )

      self.m_grid1 = wx.grid.Grid( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 150,460 ), 0 )

      self.m_grid1.CreateGrid( 30, 7 )
      self.m_grid1.EnableEditing( False )
      self.m_grid1.EnableGridLines( True )
      self.m_grid1.EnableDragGridSize( False )
      self.m_grid1.SetMargins( 0, 0 )

      self.m_grid1.EnableDragColMove( False )
      self.m_grid1.EnableDragColSize( True )
      self.m_grid1.SetColLabelSize( 30 )
      self.m_grid1.SetColLabelValue( 0, u"Date" )
      self.m_grid1.SetColLabelValue( 1, u"Enroll Id" )
      self.m_grid1.SetColLabelValue( 2, u"Name" )
      self.m_grid1.SetColLabelValue( 3, u"Phone No.")
      self.m_grid1.SetColLabelValue( 4, u"Guardian Name" )
      self.m_grid1.SetColLabelValue( 5, u"Guardian No." )
      self.m_grid1.SetColLabelValue( 6, u"Attendance" )
      self.m_grid1.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
      
      self.m_grid1.EnableDragRowSize( True )
      self.m_grid1.SetRowLabelSize( 40 )
      self.m_grid1.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
      
      self.m_grid1.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP )
      self.m_grid1.SetFont( wx.Font( 5, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "Arial" ) )
        
      bSizer8.Add( self.m_grid1, 0, wx.EXPAND, 5 )
      bSizer6.Add( bSizer8, 1, wx.EXPAND, 5 )        
      bSizer5.Add( bSizer6, 1, wx.EXPAND, 5 )
      bSizer1.Add( bSizer5, 1, wx.EXPAND, 5 )
      
      self.SetSizer( bSizer1 )
      self.Layout()
      self.Centre( wx.BOTH )
Ejemplo n.º 17
0
    def __init__(self, parent, id=wx.ID_ANY, label="", pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=0, agwStyle=wx.CP_DEFAULT_STYLE,
                 validator=wx.DefaultValidator, name="PyCollapsiblePane"):
        """
        Default class constructor.

        :param `parent`: the :class:`PyCollapsiblePane` parent. Must not be ``None``;
        :param `id`: window identifier. A value of -1 indicates a default value;
        :param `label`: The initial label shown in the button which allows the
         user to expand or collapse the pane window.
        :param `pos`: the control position. A value of (-1, -1) indicates a default position,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `size`: the control size. A value of (-1, -1) indicates a default size,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `style`: the underlying :class:`PyPanel` window style;
        :param `agwStyle`: the AGW-specifi window style. This can be a combination of the
         following bits:

         ==================== =========== ==================================================
         Window Styles        Hex Value   Description
         ==================== =========== ==================================================
         ``CP_NO_TLW_RESIZE``         0x2 By default :class:`PyCollapsiblePane` resizes the top level window containing it when its own size changes. This allows to easily implement dialogs containing an optionally shown part, for example, and so is the default behaviour but can be inconvenient in some specific cases -- use this flag to disable this automatic parent resizing then.
         ``CP_GTK_EXPANDER``          0x4 Uses a GTK expander instead of a button.
         ``CP_USE_STATICBOX``         0x8 Uses a :class:`StaticBox` around :class:`PyCollapsiblePane`.
         ``CP_LINE_ABOVE``           0x10 Draws a line above :class:`PyCollapsiblePane`.
         ==================== =========== ==================================================

        :param `validator`: the validator associated to the :class:`PyCollapsiblePane`;
        :param `name`: the widget name.
        
        """
                
        wx.PyPanel.__init__(self, parent, id, pos, size, style, name)
        
        self._pButton = self._pStaticLine = self._pPane = self._sz = None            
        self._strLabel = label
        self._bCollapsed = True
        self._agwStyle = agwStyle

        self._pPane = wx.Panel(self, style=wx.TAB_TRAVERSAL|wx.NO_BORDER)
        self._pPane.Hide()

        if self.HasAGWFlag(CP_USE_STATICBOX):
            # Use a StaticBox instead of a StaticLine, and the button's
            # position will be handled separately so don't put it in the sizer
            self._pStaticBox = wx.StaticBox(self)
            self.SetButton(wx.Button(self, wx.ID_ANY, self.GetLabel(), style=wx.BU_EXACTFIT))
            self._sz = wx.BoxSizer(wx.VERTICAL)
            self._sz.Add((1,1))  # spacer, size will be reset later
            self._contentSizer = wx.StaticBoxSizer(self._pStaticBox, wx.VERTICAL)
            self._contentSizer.Add((1,1))  # spacer, size will be reset later
            self._contentSizer.Add(self._pPane, 1, wx.EXPAND)
            self._sz.Add(self._contentSizer, 1, wx.EXPAND)                    

            if self.HasAGWFlag(CP_USE_STATICBOX) and 'wxMSW' in wx.PlatformInfo:
                # This hack is needed on Windows because wxMSW clears the
                # CLIP_SIBLINGS style from all sibling controls that overlap the
                # static box, so the box ends up overdrawing the button since we
                # have the button overlapping the box. This hack will ensure that
                # the button is refreshed after every time that the box is drawn.
                # This adds a little flicker but it is not too bad compared to
                # others.
                def paint(evt):
                    def updateBtn():
                        if self and self._pButton:
                            self._pButton.Refresh()
                            self._pButton.Update()
                    wx.CallAfter(updateBtn)
                    evt.Skip()
                self._pStaticBox.Bind(wx.EVT_PAINT, paint)

        elif self.HasAGWFlag(CP_GTK_EXPANDER):
            self._sz = wx.BoxSizer(wx.HORIZONTAL)
            self.SetExpanderDimensions(3, 6)
            self.SetButton(GTKExpander(self, wx.ID_ANY, self.GetLabel()))
            self._sz.Add(self._pButton, 0, wx.LEFT|wx.TOP|wx.BOTTOM, self.GetBorder())

            self._pButton.Bind(wx.EVT_PAINT, self.OnDrawGTKStyle)
            self._pButton.Bind(wx.EVT_LEFT_DOWN, self.OnButton)
            if wx.Platform == "__WXMSW__":
                self._pButton.Bind(wx.EVT_LEFT_DCLICK, self.OnButton)

        else:
            # create children and lay them out using a wx.BoxSizer
            # (so that we automatically get RTL features)
            self.SetButton(wx.Button(self, wx.ID_ANY, self.GetLabel(), style=wx.BU_EXACTFIT))
            self._pStaticLine = wx.StaticLine(self, wx.ID_ANY)

            if self.HasAGWFlag(CP_LINE_ABOVE): 
                # put the static line above the button
                self._sz = wx.BoxSizer(wx.VERTICAL)
                self._sz.Add(self._pStaticLine, 0, wx.ALL|wx.GROW, self.GetBorder())
                self._sz.Add(self._pButton, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, self.GetBorder())
            else:
                # arrange the static line and the button horizontally
                self._sz = wx.BoxSizer(wx.HORIZONTAL)
                self._sz.Add(self._pButton, 0, wx.LEFT|wx.TOP|wx.BOTTOM, self.GetBorder())
                self._sz.Add(self._pStaticLine, 1, wx.ALIGN_CENTER|wx.LEFT|wx.RIGHT, self.GetBorder())
            
        self.Bind(wx.EVT_SIZE, self.OnSize)
Ejemplo n.º 18
0
    def __init__(self, parent):
        super(GroupPanel, self).__init__(parent)

        self.face_paths = []
        self.faces = {}

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

        self.panel = scrolled.ScrolledPanel(self)

        self.hsizer = wx.BoxSizer()
        self.hsizer.AddStretchSpacer()

        self.hvsizer = wx.BoxSizer(wx.VERTICAL)
        self.hvsizer.SetMinSize((util.INNER_PANEL_WIDTH, -1))

        label = ('Click the button below to select a folder containing face '
                 'images.\nThe images will be grouped based on similarity.\n'
                 'You will see the different groups under the "Grouping '
                 'Results" label.')
        self.static_text = wx.StaticText(self.panel, label=label)
        self.static_text.Wrap(util.INNER_PANEL_WIDTH)
        self.hvsizer.Add(self.static_text, 0, wx.ALL, 0)

        self.vhsizer = wx.BoxSizer()

        self.lsizer = wx.BoxSizer(wx.VERTICAL)
        self.lsizer.SetMinSize((util.MAX_IMAGE_SIZE, -1))

        flag = wx.EXPAND | wx.ALIGN_CENTER | wx.ALL
        self.btn = wx.Button(self.panel, label='Group')
        self.lsizer.Add(self.btn, 0, flag, 5)
        self.Bind(wx.EVT_BUTTON, self.OnChooseFolder, self.btn)

        self.grid = base.MyGridStaticBitmap(self.panel, 0, 4, 0, 0)
        self.lsizer.Add(self.grid, 0, wx.ALL, 5)

        self.vhsizer.Add(self.lsizer, 1, wx.EXPAND)
        self.vhsizer.AddSpacer(90)

        self.rsizer = wx.BoxSizer(wx.VERTICAL)
        self.rsizer.SetMinSize((util.MAX_IMAGE_SIZE, -1))

        flag = wx.ALIGN_CENTER | wx.EXPAND | wx.ALL
        self.result_text = wx.StaticText(self.panel, label='Grouping Results:')
        self.rsizer.Add(self.result_text, 0, flag, 5)

        self.result = base.GroupResult(self.panel)
        self.rsizer.Add(self.result, 0, wx.EXPAND)

        self.vhsizer.Add(self.rsizer, 1, wx.EXPAND)

        self.hvsizer.Add(self.vhsizer)

        self.hsizer.Add(self.hvsizer)
        self.hsizer.AddStretchSpacer()
        self.hsizer.Layout()

        self.panel.SetSizer(self.hsizer)
        self.panel.Layout()
        self.panel.SetupScrolling(scroll_x=False)

        self.vsizer.Add(self.panel, 3, wx.EXPAND)

        self.log = base.MyLog(self)
        self.vsizer.Add(self.log, 1, wx.EXPAND)

        self.SetSizerAndFit(self.vsizer)
Ejemplo n.º 19
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, size=wx.Size(320, 320))
        self.SetBackgroundColour(wx.Colour(0, 0, 0))

        self.interaction_style = st.StyleStateManager()

        self.ball_reference = None
        self.initial_foco = None

        style = vtk.vtkInteractorStyleTrackballCamera()
        self.style = style

        interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize())
        interactor.SetInteractorStyle(style)
        self.interactor = interactor

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(interactor, 1, wx.EXPAND)
        self.sizer = sizer
        self.SetSizer(sizer)
        self.Layout()

        # It would be more correct (API-wise) to call interactor.Initialize() and
        # interactor.Start() here, but Initialize() calls RenderWindow.Render().
        # That Render() call will get through before we can setup the
        # RenderWindow() to render via the wxWidgets-created context; this
        # causes flashing on some platforms and downright breaks things on
        # other platforms.  Instead, we call widget.Enable().  This means
        # that the RWI::Initialized ivar is not set, but in THIS SPECIFIC CASE,
        # that doesn't matter.
        interactor.Enable(1)

        ren = vtk.vtkRenderer()
        interactor.GetRenderWindow().AddRenderer(ren)
        self.ren = ren

        self.raycasting_volume = False

        self.onclick = False

        self.text = vtku.Text()
        self.text.SetValue("")
        self.ren.AddActor(self.text.actor)

        self.slice_plane = None

        self.view_angle = None

        self.__bind_events()
        self.__bind_events_wx()

        self.mouse_pressed = 0
        self.on_wl = False

        self.picker = vtk.vtkPointPicker()
        interactor.SetPicker(self.picker)
        self.seed_points = []

        self.points_reference = []

        self.measure_picker = vtk.vtkPropPicker()
        #self.measure_picker.SetTolerance(0.005)
        self.measures = []

        self._last_state = 0

        self.repositioned_axial_plan = 0
        self.repositioned_sagital_plan = 0
        self.repositioned_coronal_plan = 0
        self.added_actor = 0

        self._mode_cross = False
        self._to_show_ball = 0
        self._ball_ref_visibility = False
Ejemplo n.º 20
0
    def __init__(self, canvas: "EditCanvas"):
        wx.BoxSizer.__init__(self, wx.HORIZONTAL)
        CameraToolUI.__init__(self, canvas)

        self._selection = BlockSelectionBehaviour(self.canvas)
        self._inspect_block = InspectBlockBehaviour(self.canvas,
                                                    self._selection)

        self._button_panel = wx.Panel(canvas)
        button_sizer = wx.BoxSizer(wx.VERTICAL)
        self._button_panel.SetSizer(button_sizer)
        delete_button = wx.Button(self._button_panel, label="Delete")
        button_sizer.Add(delete_button, 0, wx.ALL | wx.EXPAND, 5)
        delete_button.Bind(wx.EVT_BUTTON, lambda evt: self.canvas.delete())
        copy_button = wx.Button(self._button_panel, label="Copy")
        button_sizer.Add(copy_button, 0, wx.ALL | wx.EXPAND, 5)
        copy_button.Bind(wx.EVT_BUTTON, lambda evt: self.canvas.copy())
        cut_button = wx.Button(self._button_panel, label="Cut")
        button_sizer.Add(cut_button, 0, wx.ALL | wx.EXPAND, 5)
        cut_button.Bind(wx.EVT_BUTTON, lambda evt: self.canvas.cut())
        paste_button = wx.Button(self._button_panel, label="Paste")
        button_sizer.Add(paste_button, 0, wx.ALL | wx.EXPAND, 5)
        paste_button.Bind(wx.EVT_BUTTON,
                          lambda evt: self.canvas.paste_from_cache())
        self.Add(self._button_panel, 0, wx.ALIGN_CENTER_VERTICAL)

        self._x1: wx.SpinCtrl = self._add_row("x1",
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._y1: wx.SpinCtrl = self._add_row("y1",
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._z1: wx.SpinCtrl = self._add_row("z1",
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._x1.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._y1.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._z1.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._x1.SetValidator(IntValidator())
        self._y1.SetValidator(IntValidator())
        self._z1.SetValidator(IntValidator())

        self._x2: wx.SpinCtrl = self._add_row("x2",
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._y2: wx.SpinCtrl = self._add_row("y2",
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._z2: wx.SpinCtrl = self._add_row("z2",
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._x2.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._y2.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._z2.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._x2.SetValidator(IntValidator())
        self._y2.SetValidator(IntValidator())
        self._z2.SetValidator(IntValidator())

        self._x1.Disable()
        self._y1.Disable()
        self._z1.Disable()
        self._x2.Disable()
        self._y2.Disable()
        self._z2.Disable()

        self._x1.SetBackgroundColour((160, 215, 145))
        self._y1.SetBackgroundColour((160, 215, 145))
        self._z1.SetBackgroundColour((160, 215, 145))

        self._x2.SetBackgroundColour((150, 150, 215))
        self._y2.SetBackgroundColour((150, 150, 215))
        self._z2.SetBackgroundColour((150, 150, 215))
Ejemplo n.º 21
0
    def __init__(self,
                 image,
                 parent=None,
                 id=-1,
                 pos=wx.DefaultPosition,
                 title="Face Recognidtion Viewer"):
        wx.Frame.__init__(self, parent, title=title, size=(960, 500))

        #=======================================================================
        self.capture = cv2.VideoCapture(0)
        #uncomment 2 lines below for opencv3
        #self.capture.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
        #self.capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)

        #uncomment 2 lines below for opencv2
        self.capture.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, 640)
        self.capture.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, 480)
        #=======================================================================

        panel = wx.Panel(self, -1)  # Make a new panel inside the frame
        panel.SetBackgroundColour('#ededed')  # Set 'panels' bgcolor

        leftPan = wx.Panel(panel,
                           -1)  # Make a subpanel for the left of 'panel'
        leftPan.SetBackgroundColour('#4f5049')  # Set 'leftPan' bgcolor

        rightPan = wx.Panel(panel,
                            -1)  # Make a subpanel for the right of 'panel'
        rightPan.SetBackgroundColour('#ededed')  # Set 'rightPan' bgcolor

        vbox = wx.BoxSizer(wx.HORIZONTAL)  # Make a new sizer for 'panel'

        vbox.Add(leftPan, 2, wx.EXPAND | wx.ALL,
                 10)  # Add both subpanels to the new sizer \
        vbox.Add(rightPan, 1, wx.EXPAND | wx.ALL, 10)  # in order

        panel.SetSizer(
            vbox)  # set the sizer containing 'leftPan' and 'rightPan'

        ShowCapture(leftPan, self.capture)

        gridSizer = wx.GridBagSizer(vgap=6, hgap=6)
        rightPan.SetSizer(gridSizer)
        self.labelInput = wx.TextCtrl(rightPan, -1)
        trainBtn = wx.Button(rightPan, -1, label="Train")
        self.updatePath = wx.TextCtrl(
            rightPan,
            -1,
            value="192.168.100.1:/home/intel",
        )
        updateBtn = wx.Button(rightPan, label="Update")
        inferInfo = wx.StaticText(rightPan, -1)
        inferBtn = wx.Button(rightPan, -1, label="Infer")

        self.outputInfoPanel = wx.StaticText(rightPan)

        gridSizer.Add(self.labelInput,
                      pos=(0, 0),
                      span=(1, 5),
                      flag=wx.EXPAND | wx.ALL,
                      border=10)
        gridSizer.Add(trainBtn,
                      pos=(0, 5),
                      span=(1, 1),
                      flag=wx.EXPAND | wx.ALL,
                      border=10)
        gridSizer.Add(self.updatePath,
                      pos=(1, 0),
                      span=(1, 5),
                      flag=wx.EXPAND | wx.ALL,
                      border=10)
        gridSizer.Add(updateBtn,
                      pos=(1, 5),
                      span=(1, 1),
                      flag=wx.EXPAND | wx.ALL,
                      border=10)
        gridSizer.Add(inferInfo,
                      pos=(2, 0),
                      span=(1, 5),
                      flag=wx.EXPAND | wx.ALL,
                      border=10)
        gridSizer.Add(inferBtn,
                      pos=(2, 5),
                      span=(1, 1),
                      flag=wx.EXPAND | wx.ALL,
                      border=10)
        gridSizer.Add(self.outputInfoPanel,
                      pos=(3, 0),
                      span=(3, 6),
                      flag=wx.EXPAND | wx.ALL,
                      border=10)

        self.Bind(wx.EVT_BUTTON, self.train, trainBtn)
        self.Bind(wx.EVT_BUTTON, self.infer, inferBtn)
        self.Bind(wx.EVT_BUTTON, self.update, updateBtn)

        self.openface = OpenFace()
Ejemplo n.º 22
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=App_title,
                          pos=wx.DefaultPosition,
                          size=wx.Size(913, 641),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_INACTIVECAPTION))

        bSizer1 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer2 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer3 = wx.BoxSizer(wx.VERTICAL)

        sbSizer1 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"原始图像"),
                                     wx.VERTICAL)

        self.orgin_img = wx.StaticBitmap(sbSizer1.GetStaticBox(), wx.ID_ANY,
                                         wx.NullBitmap, wx.DefaultPosition,
                                         wx.DefaultSize, 0)
        sbSizer1.Add(self.orgin_img, 1, wx.ALL | wx.EXPAND, 5)

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

        sbSizer2 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"人姿和手部检测"),
                                     wx.VERTICAL)

        self.result_img = wx.StaticBitmap(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                          wx.NullBitmap, wx.DefaultPosition,
                                          wx.DefaultSize, 0)
        sbSizer2.Add(self.result_img, 1, wx.ALL | wx.EXPAND, 5)

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

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

        bSizer4 = wx.BoxSizer(wx.VERTICAL)

        sbSizer3 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"运行日志"),
                                     wx.VERTICAL)

        self.tips = wx.TextCtrl(sbSizer3.GetStaticBox(), wx.ID_ANY,
                                wx.EmptyString, wx.DefaultPosition,
                                wx.DefaultSize,
                                wx.TE_MULTILINE | wx.TE_READONLY)
        sbSizer3.Add(self.tips, 1, wx.ALL | wx.EXPAND, 5)

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

        sbSizer4 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"检测结果"),
                                     wx.VERTICAL)

        self.result = wx.TextCtrl(sbSizer4.GetStaticBox(), wx.ID_ANY,
                                  wx.EmptyString, wx.DefaultPosition,
                                  wx.DefaultSize,
                                  wx.TE_MULTILINE | wx.TE_READONLY)
        sbSizer4.Add(self.result, 1, wx.ALL | wx.EXPAND, 5)

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

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

        bSizer5 = wx.BoxSizer(wx.VERTICAL)

        sbSizer5 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"控制台"),
                                     wx.VERTICAL)

        sbSizer6 = wx.StaticBoxSizer(
            wx.StaticBox(sbSizer5.GetStaticBox(), wx.ID_ANY, u"选择视频或文件"),
            wx.HORIZONTAL)

        self.m_button7 = wx.Button(sbSizer6.GetStaticBox(), wx.ID_ANY, u"选择图片",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        sbSizer6.Add(self.m_button7, 1, wx.ALL | wx.EXPAND, 5)

        self.m_button8 = wx.Button(sbSizer6.GetStaticBox(), wx.ID_ANY, u"选择视频",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        sbSizer6.Add(self.m_button8, 1, wx.ALL | wx.EXPAND, 5)

        sbSizer5.Add(sbSizer6, 0, wx.EXPAND, 5)

        sbSizer7 = wx.StaticBoxSizer(
            wx.StaticBox(sbSizer5.GetStaticBox(), wx.ID_ANY, u"特征提取"),
            wx.VERTICAL)

        self.m_button1 = wx.Button(sbSizer7.GetStaticBox(), wx.ID_ANY, u"特征提取",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        sbSizer7.Add(self.m_button1, 0, wx.ALL | wx.EXPAND, 5)

        sbSizer5.Add(sbSizer7, 0, wx.EXPAND, 5)

        sbSizer8 = wx.StaticBoxSizer(
            wx.StaticBox(sbSizer5.GetStaticBox(), wx.ID_ANY, u"手语预测"),
            wx.VERTICAL)

        self.m_button5 = wx.Button(sbSizer8.GetStaticBox(), wx.ID_ANY,
                                   u"选择分类模型", wx.DefaultPosition,
                                   wx.DefaultSize, 0)
        sbSizer8.Add(self.m_button5, 0, wx.ALL | wx.EXPAND, 5)

        self.m_button6 = wx.Button(sbSizer8.GetStaticBox(), wx.ID_ANY, u"预测",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
        sbSizer8.Add(self.m_button6, 0, wx.ALL | wx.EXPAND, 5)

        sbSizer5.Add(sbSizer8, 0, wx.EXPAND, 5)

        sbSizer9 = wx.StaticBoxSizer(
            wx.StaticBox(sbSizer5.GetStaticBox(), wx.ID_ANY, u"示例图"),
            wx.VERTICAL)

        self.black_img = wx.StaticBitmap(sbSizer9.GetStaticBox(), wx.ID_ANY,
                                         wx.NullBitmap, wx.DefaultPosition,
                                         wx.DefaultSize, 0)
        sbSizer9.Add(self.black_img, 1, wx.ALL | wx.EXPAND, 5)

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

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

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

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

        self.SetSizer(bSizer1)
        self.Layout()
        self.m_menubar1 = wx.MenuBar(0)
        self.m_menubar1.SetForegroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_ACTIVECAPTION))
        self.m_menubar1.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_ACTIVECAPTION))

        self.m_menu1 = wx.Menu()
        self.m_menuItem1 = wx.MenuItem(self.m_menu1, wx.ID_ANY, u"图片",
                                       wx.EmptyString, wx.ITEM_NORMAL)
        self.m_menu1.Append(self.m_menuItem1)

        self.m_menuItem2 = wx.MenuItem(self.m_menu1, wx.ID_ANY, u"视频",
                                       wx.EmptyString, wx.ITEM_NORMAL)
        self.m_menu1.Append(self.m_menuItem2)

        self.m_menubar1.Append(self.m_menu1, u"检测")

        self.m_menu2 = wx.Menu()
        self.m_menubar1.Append(self.m_menu2, u"采集")

        self.m_menu3 = wx.Menu()
        self.m_menubar1.Append(self.m_menu3, u"关于")

        self.SetMenuBar(self.m_menubar1)

        self.m_statusBar2 = self.CreateStatusBar(1, wx.STB_SIZEGRIP, wx.ID_ANY)
        self.m_statusBar2.SetForegroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_ACTIVECAPTION))
        self.m_statusBar2.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_ACTIVECAPTION))

        self.Centre(wx.BOTH)

        # Connect Events
        self.m_button7.Bind(wx.EVT_BUTTON, self.img_btn)
        self.m_button8.Bind(wx.EVT_BUTTON, self.video_btn)
        self.m_button1.Bind(wx.EVT_BUTTON, self.feature_btn)
        self.m_button5.Bind(wx.EVT_BUTTON, self.chosemodel_btn)
        self.m_button6.Bind(wx.EVT_BUTTON, self.predict_btn)
        """界面"""
        self.image_demo = wx.Image(DEMO, wx.BITMAP_TYPE_ANY).Scale(500, 400)
        self.bmp = wx.StaticBitmap(self.black_img, -1,
                                   wx.Bitmap(self.image_demo))

        # 设置窗口标题的图标
        self.icon = wx.Icon(ICO, wx.BITMAP_TYPE_ICO)
        self.SetIcon(self.icon)
        print("wxpython界面初始化加载完成!")
        """参数"""
        #
        self.VIDEO_STREAM = False
        self.IMAGE_STREAM = False
        self.orgin_img_show = root_path + 'docs/images/brave_40.jpg'  # 默认预测图片
        self.model_path = root_path + 'model/'  # 训练的深度模型
        self._loadmodel()  # 加载OpenPose和yolo模型

        self.beyes_model = root_path + 'model/train_model.m'  # 默认贝叶斯模型
        self.XX_test = []  # 测试集
Ejemplo n.º 23
0
    def __init__(self, parent):
	wx.Dialog.__init__(self,parent,-1, _('Login'))
	
	self.name=""
	self.file=""
	
	box = wx.BoxSizer(wx.VERTICAL)

	#Get list of users
	self.users = get_users()
	
#	p, f_name=get_f_name()
#	if os.path.exists(p):
#	    users=os.listdir(p)
#	else:
#	    users=[_('empty')]
#   	users.sort()
	
	#======== List users ==============
	i = wx.NewId()
        self.il = wx.ImageList(16, 16,True)
	bmp=wx.Bitmap(os.path.join(bitmaps_dir, 'smiles.bmp'), wx.BITMAP_TYPE_BMP)
	mask = wx.Mask(bmp, wx.WHITE)
	bmp.SetMask(mask)
	
	idx1 = self.il.Add(bmp)

        self.list = wx.ListCtrl(self, i, size=wx.Size(200, 200),
                   style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_SINGLE_SEL)
        self.list.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
	self.list.InsertColumn(0, _('Your name'))
	for k in range(len(self.users)):
	    self.list.InsertImageStringItem(k, self.users[k][0], idx1)
	self.list.SetColumnWidth(0, 180)
	self.list.SetItemState(0, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
	self.name=self.users[0][0]
	self.file=self.users[0][1]
	
	self.list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.list)
	self.list.Bind(wx.EVT_LIST_KEY_DOWN, self.OnKeyDown, self.list)
	
	box.Add(self.list, 0, wx.ALL, 10)
	
        #========= Add user =============
	i=wx.NewId()
	box.Add(wx.Button(self, i, _('Add user')), 0, wx.ALIGN_CENTER)
	self.Bind(wx.EVT_BUTTON, self.OnAdd, id=i)
	
	#========= Ok - Cancel =============
	b1=wx.BoxSizer(wx.HORIZONTAL)
	i=wx.NewId()
	b1.Add(wx.Button(self, i, _('Ok')), 0, wx.ALL, 10)
	self.Bind(wx.EVT_BUTTON, self.OnOk, id=i)
	
	i=wx.NewId()
	b1.Add(wx.Button(self, i, _('Cancel')), 0, wx.ALL, 10)
	self.Bind(wx.EVT_BUTTON, self.OnCancel, id=i)
	box.Add(b1, 0, wx.ALIGN_CENTER)

	self.SetAutoLayout(True)
        self.SetSizer(box)
	box.Fit(self)
	self.list.SetFocus()
Ejemplo n.º 24
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=u"G-code Z Splicer",
                          pos=wx.DefaultPosition,
                          size=wx.Size(900, 400),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

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

        mainFrame_sizer = wx.BoxSizer(wx.VERTICAL)

        self.mainPanel = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition,
                                  wx.DefaultSize, wx.TAB_TRAVERSAL)
        mainPanel_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.m_scrolledWindow = wx.ScrolledWindow(
            self.mainPanel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize,
            wx.ALWAYS_SHOW_SB | wx.HSCROLL)
        self.m_scrolledWindow.SetScrollRate(5, 5)
        scrolledWindow_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.FirstGCodePanel = GCodePanel(self.m_scrolledWindow, wx.ID_ANY,
                                          wx.DefaultPosition, wx.DefaultSize,
                                          wx.TAB_TRAVERSAL)
        scrolledWindow_sizer.Add(self.FirstGCodePanel, 1, wx.EXPAND | wx.ALL,
                                 5)

        self.m_staticline_column = wx.StaticLine(self.m_scrolledWindow,
                                                 wx.ID_ANY, wx.DefaultPosition,
                                                 wx.DefaultSize,
                                                 wx.LI_VERTICAL)
        scrolledWindow_sizer.Add(self.m_staticline_column, 0, wx.EXPAND, 5)

        self.FirstTransitionPanel = TransitionPanel(self.m_scrolledWindow,
                                                    wx.ID_ANY,
                                                    wx.DefaultPosition,
                                                    wx.DefaultSize,
                                                    wx.TAB_TRAVERSAL)
        scrolledWindow_sizer.Add(self.FirstTransitionPanel, 1,
                                 wx.EXPAND | wx.ALL, 5)

        self.m_staticline_column1 = wx.StaticLine(self.m_scrolledWindow,
                                                  wx.ID_ANY,
                                                  wx.DefaultPosition,
                                                  wx.DefaultSize,
                                                  wx.LI_VERTICAL)
        scrolledWindow_sizer.Add(self.m_staticline_column1, 0,
                                 wx.EXPAND | wx.ALL, 5)

        self.SecondGCodePanel = GCodePanel(self.m_scrolledWindow, wx.ID_ANY,
                                           wx.DefaultPosition, wx.DefaultSize,
                                           wx.TAB_TRAVERSAL)
        scrolledWindow_sizer.Add(self.SecondGCodePanel, 1, wx.EXPAND | wx.ALL,
                                 5)

        self.m_scrolledWindow.SetSizer(scrolledWindow_sizer)
        self.m_scrolledWindow.Layout()
        scrolledWindow_sizer.Fit(self.m_scrolledWindow)
        mainPanel_sizer.Add(self.m_scrolledWindow, 1, wx.EXPAND | wx.ALL, 5)

        self.m_staticline9 = wx.StaticLine(self.mainPanel, wx.ID_ANY,
                                           wx.DefaultPosition, wx.DefaultSize,
                                           wx.LI_VERTICAL)
        mainPanel_sizer.Add(self.m_staticline9, 0, wx.EXPAND | wx.ALL, 5)

        bSizer19 = wx.BoxSizer(wx.VERTICAL)

        self.addFileButton = wx.Button(self.mainPanel, wx.ID_ANY, u"Add File",
                                       wx.DefaultPosition, wx.DefaultSize, 0)
        self.addFileButton.Enable(False)

        bSizer19.Add(self.addFileButton, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.removeFileButton = wx.Button(self.mainPanel, wx.ID_ANY,
                                          u"Remove File", wx.DefaultPosition,
                                          wx.DefaultSize, 0)
        self.removeFileButton.Enable(False)

        bSizer19.Add(self.removeFileButton, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        bSizer19.AddSpacer((0, 0), 1, wx.EXPAND, 5)

        mainPanel_sizer.Add(bSizer19, 0, wx.ALIGN_RIGHT | wx.EXPAND, 5)

        self.mainPanel.SetSizer(mainPanel_sizer)
        self.mainPanel.Layout()
        mainPanel_sizer.Fit(self.mainPanel)
        mainFrame_sizer.Add(self.mainPanel, 1, wx.EXPAND, 5)

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

        self.BottomPanel = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition,
                                    wx.DefaultSize, wx.TAB_TRAVERSAL)
        bSizer5 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_staticText1 = wx.StaticText(self.BottomPanel, wx.ID_ANY,
                                           u"Result file:", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.m_staticText1.Wrap(-1)
        bSizer5.Add(self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                    5)

        self.resultFilePicker = wx.FilePickerCtrl(
            self.BottomPanel, wx.ID_ANY, u"out.gcode", u"Select a file",
            u"*.*", wx.DefaultPosition, wx.DefaultSize,
            wx.FLP_OVERWRITE_PROMPT | wx.FLP_SAVE | wx.FLP_USE_TEXTCTRL)
        bSizer5.Add(self.resultFilePicker, 1, wx.ALL, 5)

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

        self.generate_button = wx.Button(self.BottomPanel, wx.ID_ANY,
                                         u"Generate", wx.DefaultPosition,
                                         wx.DefaultSize, 0)
        bSizer5.Add(self.generate_button, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.quit_button = wx.Button(self.BottomPanel, wx.ID_ANY, u"Quit",
                                     wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer5.Add(self.quit_button, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.BottomPanel.SetSizer(bSizer5)
        self.BottomPanel.Layout()
        bSizer5.Fit(self.BottomPanel)
        mainFrame_sizer.Add(self.BottomPanel, 0, wx.EXPAND, 5)

        self.SetSizer(mainFrame_sizer)
        self.Layout()

        # Connect Events
        self.addFileButton.Bind(wx.EVT_BUTTON, self.OnAddFile)
        self.removeFileButton.Bind(wx.EVT_BUTTON, self.OnRemoveFile)
        self.resultFilePicker.Bind(wx.EVT_FILEPICKER_CHANGED,
                                   self.OnResultFileSelected)
        self.generate_button.Bind(wx.EVT_BUTTON, self.OnGenerate)
        self.quit_button.Bind(wx.EVT_BUTTON, self.OnClose)
Ejemplo n.º 25
0
    def __init__(self, parent, controller, type=LEFTRAIL, number=1):
        wx.Dialog.__init__(self,
                           parent,
                           size=wx.Size(350, 260),
                           title=_('Power Rail Properties'))

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        column_sizer = wx.BoxSizer(wx.HORIZONTAL)
        main_sizer.AddSizer(column_sizer,
                            border=20,
                            flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)

        left_gridsizer = wx.FlexGridSizer(cols=1, hgap=0, rows=5, vgap=5)
        left_gridsizer.AddGrowableCol(0)
        column_sizer.AddSizer(left_gridsizer,
                              1,
                              border=5,
                              flag=wx.GROW | wx.RIGHT)

        type_label = wx.StaticText(self, label=_('Type:'))
        left_gridsizer.AddWindow(type_label, flag=wx.GROW)

        self.LeftPowerRail = wx.RadioButton(self,
                                            label=_('Left PowerRail'),
                                            style=wx.RB_GROUP)
        self.LeftPowerRail.SetValue(True)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, self.LeftPowerRail)
        left_gridsizer.AddWindow(self.LeftPowerRail, flag=wx.GROW)

        self.RightPowerRail = wx.RadioButton(self, label=_('Right PowerRail'))
        self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, self.RightPowerRail)
        left_gridsizer.AddWindow(self.RightPowerRail, flag=wx.GROW)

        pin_number_label = wx.StaticText(self, label=_('Pin number:'))
        left_gridsizer.AddWindow(pin_number_label, flag=wx.GROW)

        self.PinNumber = wx.SpinCtrl(self,
                                     min=1,
                                     max=50,
                                     style=wx.SP_ARROW_KEYS)
        self.Bind(wx.EVT_SPINCTRL, self.OnPinNumberChanged, self.PinNumber)
        left_gridsizer.AddWindow(self.PinNumber, flag=wx.GROW)

        right_gridsizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
        right_gridsizer.AddGrowableCol(0)
        right_gridsizer.AddGrowableRow(1)
        column_sizer.AddSizer(right_gridsizer,
                              1,
                              border=5,
                              flag=wx.GROW | wx.LEFT)

        preview_label = wx.StaticText(self, label=_('Preview:'))
        right_gridsizer.AddWindow(preview_label, flag=wx.GROW)

        self.Preview = wx.Panel(self,
                                style=wx.TAB_TRAVERSAL | wx.SIMPLE_BORDER)
        self.Preview.SetBackgroundColour(wx.Colour(255, 255, 255))
        setattr(self.Preview, "GetDrawingMode", lambda: FREEDRAWING_MODE)
        setattr(self.Preview, "GetScaling", lambda: None)
        setattr(self.Preview, "IsOfType", controller.IsOfType)
        self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
        right_gridsizer.AddWindow(self.Preview, flag=wx.GROW)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        main_sizer.AddSizer(button_sizer,
                            border=20,
                            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT
                            | wx.RIGHT)

        self.SetSizer(main_sizer)

        self.Type = type
        if type == LEFTRAIL:
            self.LeftPowerRail.SetValue(True)
        elif type == RIGHTRAIL:
            self.RightPowerRail.SetValue(True)
        self.PinNumber.SetValue(number)

        self.PowerRailMinSize = (0, 0)
        self.PowerRail = None

        self.LeftPowerRail.SetFocus()
Ejemplo n.º 26
0
	def __do_layout_requests_page(self):
		# notebook tab with pending requests
		pnl_page = wx.Panel(self, -1)

		# -- add request area --
		hbszr = wx.StaticBoxSizer(
			wx.StaticBox(
				pnl_page,
				-1,
				_("add new request for current patient")
			),
			wx.HORIZONTAL
		)
		# label
		lab_label = wx.StaticText(
			name = 'lablabel',
			parent = pnl_page,
			id = -1,
			label = _('Lab')
		)
		# phrase wheel
		self.lab_wheel = cLabWheel(pnl_page)
		self.lab_wheel.on_resize (None)
		self.lab_wheel.add_callback_on_selection(self.on_lab_selected)
		# label
		req_id_label = wx.StaticText(
			name = 'req_id_label',
			parent = pnl_page,
			id = -1,
			label = _("Specimen ID")
		)
		# request_id field
		self.fld_request_id = wx.TextCtrl (
			pnl_page,
			wx.ID_TextCtrl_req_id,
			"",
			wx.DefaultPosition,
			wx.Size(80,-1),
			0
		)
		# "save request id" button
		self.BTN_save_request_ID = wx.Button(
			name = 'BTN_save_request_ID',
			parent = pnl_page,
			id = wx.ID_BTN_save_request_ID,
			label = _("save lab request")
		)
		self.BTN_save_request_ID.SetToolTip(_('associate chosen lab and ID with current patient'))

		hbszr.Add(lab_label, 0, wx.ALIGN_CENTER | wx.ALL, 5)
		hbszr.Add(self.lab_wheel, 0, wx.ALIGN_CENTER | wx.ALL, 5)
		hbszr.Add(req_id_label, 0, wx.ALIGN_CENTER | wx.ALL, 5)
		hbszr.Add(self.fld_request_id, 0, wx.ALIGN_CENTER| wx.ALL, 5)
		hbszr.Add(self.BTN_save_request_ID, 0, wx.ALIGN_CENTER | wx.ALL, 5)

		# -- add list of pending requests --
		self.lbox_pending = cLabIDListCtrl(
			pnl_page,
			wx.ID_pending_requests,
			size = wx.DefaultSize,
			style = wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_VRULES
		)

		self.lbox_pending.InsertColumn(0, _("date"))
		self.lbox_pending.InsertColumn(1, _("lab"))
		self.lbox_pending.InsertColumn(2, _("sample id"))
		self.lbox_pending.InsertColumn(3, _("patient"))
		self.lbox_pending.InsertColumn(4, _("status"))

		szr_page = wx.BoxSizer(wx.VERTICAL)
		szr_page.Add(hbszr,0, wx.ALIGN_LEFT | wx.ALL, 5)
		szr_page.Add(self.lbox_pending, 1, wxEXPAND | wx.ALIGN_CENTER | wx.ALL, 5)
#		szr_page.Add(self.lbox_pending, 1, wxEXPAND | wxALIGN_CENTER | wxALL, 5)

		pnl_page.SetAutoLayout(True)
		pnl_page.SetSizer(szr_page)
		szr_page.Fit(pnl_page)
		szr_page.SetSizeHints(pnl_page)

		self.AddPage(pnl_page, _("pending requests"))
Ejemplo n.º 27
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent=parent,
                           title="Send feedback",
                           style=wx.CAPTION | wx.CLOSE_BOX
                           | wx.FRAME_FLOAT_ON_PARENT | wx.RESIZE_BORDER)
        wx_accel.AutoAcceleratorMixIn.__init__(self)
        self.MinSize = (460, 460)

        panel = self.panel = wx.Panel(self)

        label = self.label_message = wx.StaticText(
            panel, label="Opinions, ideas for improvement, problems?")
        label_info = self.label_info = wx.StaticText(
            panel, label="For reply, include a contact e-mail.")
        ColourManager.Manage(label_info, "ForegroundColour",
                             wx.SYS_COLOUR_HIGHLIGHT)

        edit = self.edit_text = wx.TextCtrl(panel, style=wx.TE_MULTILINE)

        bmp = self.bmp = wx.StaticBitmap(panel, size=self.THUMB_SIZE)
        bmp.SetCursor(wx.Cursor(wx.CURSOR_HAND))
        bmp.ToolTip = "Click to show full size preview"
        self.button_ok = wx.Button(panel, label="&Confirm")
        self.button_ok.ToolTip = "Confirm message before sending"
        self.button_cancel = wx.Button(panel, label="Cancel", id=wx.ID_CANCEL)
        self.cb_fullscreen = wx.CheckBox(panel, label="&Full screen")
        self.button_saveimage = wx.Button(panel, label="Save &image")
        self.button_saveimage.ToolTip = "Save screenshot to file."
        self.cb_bmp = wx.CheckBox(panel, label="Include &screenshot")

        self.Sizer = wx.BoxSizer(wx.VERTICAL)
        sizer = self.panel.Sizer = wx.BoxSizer(wx.VERTICAL)
        sizer_upper = wx.BoxSizer(wx.HORIZONTAL)
        sizer_lower = wx.BoxSizer(wx.HORIZONTAL)
        sizer_controls = wx.BoxSizer(wx.VERTICAL)
        sizer_buttons = wx.BoxSizer(wx.HORIZONTAL)
        sizer_imagectrls = wx.BoxSizer(wx.VERTICAL)

        sizer_buttons.Add(self.button_ok, border=5, flag=wx.RIGHT)
        sizer_buttons.Add(self.button_cancel)

        sizer_imagectrls.Add(self.button_saveimage, border=8, flag=wx.BOTTOM)
        sizer_imagectrls.Add(self.cb_fullscreen, border=20, flag=wx.BOTTOM)

        sizer_controls.Add(sizer_buttons)
        sizer_controls.AddStretchSpacer()
        sizer_controls.Add(sizer_imagectrls)
        sizer_controls.Add(self.cb_bmp, border=5, flag=wx.TOP)

        sizer_upper.Add(label, flag=wx.GROW)
        sizer_upper.AddStretchSpacer()
        sizer_upper.Add(label_info)
        sizer_lower.Add(bmp, border=10, flag=wx.RIGHT)
        sizer_lower.AddStretchSpacer()
        sizer_lower.Add(sizer_controls, flag=wx.GROW)

        sizer.Add(sizer_upper, border=8, flag=wx.GROW | wx.ALL)
        sizer.Add(edit,
                  proportion=2,
                  border=8,
                  flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.GROW)
        sizer.Add(sizer_lower,
                  border=8,
                  flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.GROW)
        self.Sizer.Add(panel, proportion=1, flag=wx.GROW)

        self.Bind(wx.EVT_CHECKBOX, self.OnToggleFullScreen, self.cb_fullscreen)
        self.Bind(wx.EVT_CHECKBOX, self.OnToggleScreenshot, self.cb_bmp)
        self.Bind(wx.EVT_BUTTON, self.OnSend, self.button_ok)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.button_cancel)
        self.Bind(wx.EVT_BUTTON, self.OnSaveImage, self.button_saveimage)
        bmp.Bind(wx.EVT_LEFT_DOWN, self.OnClickScreenshot)
        self.Bind(wx.EVT_CLOSE, self.OnCancel)

        self.SetScreenshot(None)
        self.Fit()
        self.Show()
Ejemplo n.º 28
0
	def __do_layout_review_page(self):
		pnl_page = wx.Panel( self, -1)

		# -- create new grid --
		self.__grid_unreviewed_results = cLabReviewGrid(
			pnl_page,
			wx.ID_grid_unreviewed_results
		)
		self.__grid_unreviewed_results.CreateGrid(0, 8, wx.Grid.wx.GridSelectCells)
		self.__grid_unreviewed_results.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_CENTRE)
		# there is a bug in wxGTK for this method...
		self.__grid_unreviewed_results.AutoSizeColumns(True)
		self.__grid_unreviewed_results.AutoSizeRows(True)
		# what is this supposed to do ?!?
		renderer = apply(cLabJournalCellRenderer, ())
		self.__grid_unreviewed_results.SetDefaultRenderer(renderer)
		# attribute objects let you keep a set of formatting values
		# in one spot, and reuse them if needed
#		font = self.GetFont()
#		font.SetWeight(wxNORMAL)
#		attr = wxGridCellAttr()
#		attr.SetFont(font)
		#attr.SetBackgroundColour(wx.LIGHT_GREY)
#		attr.SetReadOnly(True)
		#attr.SetAlignment(wxRIGHT, -1)
#		self.__grid_unreviewed_results.SetLabelFont(font)
		# layout review grid
		self.__grid_unreviewed_results.SetColLabelValue(0, _('reviewed'))
		self.__grid_unreviewed_results.SetColLabelValue(1, _('relevant'))
		self.__grid_unreviewed_results.SetColLabelValue(2, _('patient'))
		self.__grid_unreviewed_results.SetColLabelValue(3, _('facility'))
		self.__grid_unreviewed_results.SetColLabelValue(4, _('analysis'))
		self.__grid_unreviewed_results.SetColLabelValue(5, _('result'))
		self.__grid_unreviewed_results.SetColLabelValue(6, _('range'))
		self.__grid_unreviewed_results.SetColLabelValue(7, _('info provided by lab'))
		# turn row labels off
		self.__grid_unreviewed_results.SetRowLabelSize(0)
		self.__grid_unreviewed_results.AutoSize()

		# -- add buttons --
		# "select all requests"
		self.BTN_select_all = wx.Button(
			name = 'BTN_select_all',
			parent = pnl_page,
			id = wx.ID_BTN_select_all,
			label = _("select all requests")
		)
		self.BTN_select_all.SetToolTip(_('select all requests'))
		# "mark selected as reviewed"
		self.BTN_mark_reviewed = wx.Button(
			name = 'BTN_mark_reviewed',
			parent = pnl_page,
			id = wx.ID_BTN_mark_reviewed,
			label = _("mark selected requests as reviewed")
		)
		self.BTN_mark_reviewed.SetToolTip(_('mark selected requests as reviewed'))

		szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
		szr_buttons.Add(self.BTN_select_all, 0, wx.ALIGN_CENTER_VERTICAL, 1)
		szr_buttons.Add(self.BTN_mark_reviewed, 0, wx.ALIGN_CENTER_VERTICAL, 1)

		# -- do layout --
		szr_page = wx.BoxSizer(wx.VERTICAL)
		szr_page.Add(self.__grid_unreviewed_results, 1, wxEXPAND | wx.ALIGN_CENTER | wx.ALL, 5)
		szr_page.Add(szr_buttons, 0, wxEXPAND | wx.ALIGN_CENTER | wx.ALL, 5)

		pnl_page.SetAutoLayout(True)
		pnl_page.SetSizer(szr_page)
		szr_page.Fit(pnl_page)
		szr_page.SetSizeHints(pnl_page)

		self.AddPage(pnl_page, _("unreviewed results"))
Ejemplo n.º 29
0
    def __init__(self, parent, canvas_key):

        FullscreenHoverFrame.__init__(self, parent, canvas_key)

        vbox = wx.BoxSizer(wx.VERTICAL)

        self._icon_panel = wx.Panel(self)

        self._trash_icon = ClientGUICommon.BufferedWindowIcon(
            self._icon_panel, CC.GlobalBMPs.trash)
        self._inbox_icon = ClientGUICommon.BufferedWindowIcon(
            self._icon_panel, CC.GlobalBMPs.inbox)

        icon_hbox = wx.BoxSizer(wx.HORIZONTAL)

        icon_hbox.AddF((16, 16), CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)
        icon_hbox.AddF(self._trash_icon, CC.FLAGS_VCENTER)
        icon_hbox.AddF(self._inbox_icon, CC.FLAGS_VCENTER)

        self._icon_panel.SetSizer(icon_hbox)

        # repo strings

        self._file_repos = wx.StaticText(self, label='', style=wx.ALIGN_RIGHT)

        # likes

        like_hbox = wx.BoxSizer(wx.HORIZONTAL)

        like_hbox.AddF((16, 16), CC.FLAGS_EXPAND_BOTH_WAYS)

        like_services = HydrusGlobals.client_controller.GetServicesManager(
        ).GetServices((HC.LOCAL_RATING_LIKE, ), randomised=False)

        for service in like_services:

            service_key = service.GetServiceKey()

            control = ClientGUICommon.RatingLikeCanvas(self, service_key,
                                                       canvas_key)

            like_hbox.AddF(control, CC.FLAGS_NONE)

        # each numerical one in turn

        vbox.AddF(self._icon_panel, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)
        vbox.AddF(self._file_repos, CC.FLAGS_EXPAND_BOTH_WAYS)
        vbox.AddF(like_hbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)

        numerical_services = HydrusGlobals.client_controller.GetServicesManager(
        ).GetServices((HC.LOCAL_RATING_NUMERICAL, ), randomised=False)

        for service in numerical_services:

            service_key = service.GetServiceKey()

            control = ClientGUICommon.RatingNumericalCanvas(
                self, service_key, canvas_key)

            hbox = wx.BoxSizer(wx.HORIZONTAL)

            hbox.AddF((16, 16), CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)
            hbox.AddF(control, CC.FLAGS_NONE)

            vbox.AddF(hbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)

        self.SetSizer(vbox)

        self._ResetData()

        HydrusGlobals.client_controller.sub(self, 'ProcessContentUpdates',
                                            'content_updates_gui')

        self.Bind(wx.EVT_MOUSEWHEEL, self.EventMouseWheel)
Ejemplo n.º 30
0
    def __init__(self, parent=None, id=wx.ID_ANY):
        wx.Frame.__init__(self, parent, id, 'Turing Machine', size=(660,440),
                          style=wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX)
                          #style used to disable window resizing

        #the frame's sizer divides it into the top part, used for controls,
        #and the bottom one, used for the tapes and the program.
        self.SetSizer(wx.BoxSizer(wx.VERTICAL))


        #===Top section (with controls)===
        controls_panel = make_layout_panel(self, wx.HORIZONTAL)
        self.Sizer.Add(controls_panel, 0, wx.EXPAND)


        program_label = wx.StaticText(controls_panel, label="Program: ") 
        controls_panel.Sizer.Add(program_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, BORDER)

        program_chooser = wx.Choice(controls_panel)
        for program in programs.plist:
            program_chooser.Append(program.name)
        controls_panel.Sizer.Add(program_chooser, 0, wx.EXPAND|wx.ALL, BORDER)
        
        
        speed_label = wx.StaticText(controls_panel, label="Simulation speed (steps/sec): ") 
        controls_panel.Sizer.Add(speed_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, BORDER)
        
        speed_input = wx.SpinCtrl(controls_panel, min=1, initial=8, value='8', size=(60,-1))
        controls_panel.Sizer.Add(speed_input, 0, wx.EXPAND|wx.ALL, BORDER)


        run_pause_button = wx.Button(controls_panel, label="Run")
        run_pause_button.Enable(False)
        controls_panel.Sizer.Add(run_pause_button, 0, wx.EXPAND|wx.ALL, BORDER)
        
        reset_button = wx.Button(controls_panel, label="Reset")
        reset_button.Enable(False)
        controls_panel.Sizer.Add(reset_button, 0, wx.EXPAND|wx.ALL, BORDER)
        #===End of top section===


        #===Main section (tapes and program)===
        main_panel = make_layout_panel(self, wx.HORIZONTAL)
        self.Sizer.Add(main_panel, 1, wx.EXPAND)

        #the tapes are added dinamically, so here we only define the support panel
        tapes_panel = make_layout_panel(main_panel, wx.VERTICAL, size=(230,-1), style=wx.BORDER_SIMPLE)
        main_panel.Sizer.Add(tapes_panel, 0, wx.EXPAND)

        program_table = wx.ListCtrl(main_panel, style=wx.LC_REPORT|wx.LC_SINGLE_SEL)
        program_table.InsertColumn(0, "State")
        program_table.InsertColumn(1, "Read")
        program_table.InsertColumn(2, "To Write")
        program_table.InsertColumn(3, "Move")
        program_table.InsertColumn(4, "Next State")
        main_panel.Sizer.Add(program_table, 1, wx.EXPAND)
        #===End of main section===


        self.Bind(wx.EVT_CHOICE, self.change_program, program_chooser)
        self.Bind(wx.EVT_BUTTON, self.run_pause, run_pause_button)
        self.Bind(wx.EVT_BUTTON, self.reset, reset_button)

        #for simplicity, we defined all elements locally, without using self,
        #and then we export only those that are needed
        self.program_chooser = program_chooser
        self.speed_input = speed_input
        self.run_pause_button = run_pause_button
        self.reset_button = reset_button
        self.tapes_panel = tapes_panel
        self.program_table = program_table
        
        self.tape_panels = list()