def Init(self, structures, dose, plan, dvhs):
        """Method called after the panel has been initialized."""

        # Initialize the Conformality selector controls
        self.lblType = XRCCTRL(self, 'lblType')
        self.choiceConformalityStructure = XRCCTRL(
            self, 'choiceConformalityStructure')
        self.choiceConformalityDose = XRCCTRL(self, 'choiceConformalityDose')
        self.lblConformalityIndex = XRCCTRL(self, 'lblConformalityIndex')
        self.lblUnderdoseRatio = XRCCTRL(self, 'lblUnderdoseRatio')
        self.lblOverdoseRatio = XRCCTRL(self, 'lblOverdoseRatio')
        self.lblTargetVolume = XRCCTRL(self, 'lblTargetVolume')
        self.lblCoverageVolume = XRCCTRL(self, 'lblCoverageVolume')
        self.lblIsodoseVolume = XRCCTRL(self, 'lblIsodoseVolume')

        # Bind ui events to the proper methods
        wx.EVT_CHOICE(self, XRCID('choiceConformalityStructure'),
                      self.OnStructureSelect)
        wx.EVT_CHOICE(self, XRCID('choiceConformalityDose'),
                      self.OnIsodoseSelect)

        # Initialize variables
        self.structures = structures
        self.dose = dose
        self.rxdose = plan['rxdose']
        self.dvhs = dvhs
        self.conformalitydata = {}
        self.structureid = {}
        self.dvhdata = {}
        self.PopulateStructureChoices()
Exemplo n.º 2
0
    def __init__(self, parent, ID, title=_("Soulforge config")):
        wx.Dialog.__init__(self, parent, ID, title)

        self.modified = False
        self.config = wx.Config.Get()

        pan = wx.Panel(self, -1)
        ts = wx.BoxSizer(wx.VERTICAL)
        ts.Add(pan, 1, wx.EXPAND | wx.ALL)
        self.SetSizer(ts)

        root = wx.BoxSizer(wx.VERTICAL)

        zipbox = wx.BoxSizer(wx.VERTICAL)
        str = _("Algorithm for transparently compressing"
                ) + " *" + headerdata.SF_COMPRESSED_EXT + " " + _("files:")
        zipbox.Add(wx.StaticText(pan, -1, str), 0, wx.ALIGN_LEFT)
        self.compress = wx.Choice(pan, SFCONFIG_COMPRESS, wx.DefaultPosition,
                                  wx.DefaultSize,
                                  headerdata.SF_COMPRESSION_STRINGS)
        self.compress.SetStringSelection(
            self.config.Read(headerdata.SF_CONFIGKEY_COMPRESS,
                             headerdata.SF_CONFIGDEFAULT_COMPRESS))
        zipbox.Add(self.compress, 1, wx.EXPAND)
        root.Add(zipbox, 0, wx.EXPAND)

        rngbox = wx.BoxSizer(wx.VERTICAL)
        rngl = wx.StaticText(pan, -1,
                             "Preferred pseudo-random number generator:")
        rngbox.Add(rngl, 0, wx.ALIGN_LEFT)
        self.rng = wx.Choice(pan, SFCONFIG_RNG, wx.DefaultPosition,
                             wx.DefaultSize,
                             headerdata.SF_DIEROLLER_RNGSTRINGS)
        self.rng.SetStringSelection(
            self.config.Read(headerdata.SF_CONFIGKEY_RNG,
                             headerdata.SF_CONFIGDEFAULT_RNG))
        rngbox.Add(self.rng, 1, wx.EXPAND)
        root.Add(rngbox, 0, wx.EXPAND)

        bbox = wx.BoxSizer(wx.HORIZONTAL)
        self.apply = wx.Button(pan, SFCONFIG_APPLY, _("Apply"))
        bbox.Add(self.apply, 1, wx.EXPAND)
        bbox.Add(wx.Button(pan, SFCONFIG_CANCEL, _("Cancel")), 1, wx.EXPAND)
        self.ok = wx.Button(pan, SFCONFIG_OK, _("Ok"))
        bbox.Add(self.ok, 1, wx.EXPAND)
        root.Add(bbox, 0, wx.EXPAND)

        pan.SetSizer(root)
        self.Fit()
        self.Centre(wx.BOTH)

        self.updategui()

        wx.EVT_BUTTON(self, SFCONFIG_OK, self.onok)
        wx.EVT_BUTTON(self, SFCONFIG_CANCEL, self.oncancel)
        wx.EVT_BUTTON(self, SFCONFIG_APPLY, self.onapply)
        wx.EVT_CHOICE(self, SFCONFIG_COMPRESS, self.onchange)
        wx.EVT_CHOICE(self, SFCONFIG_RNG, self.onchange)
Exemplo n.º 3
0
 def __init__(self,parent,gr):
     self.parent=parent
     wx.Panel.__init__(self,parent,-1,size=(-1,350))
     bxSizer=wx.StaticBoxSizer(wx.StaticBox(self, -1, parent.traduit(gr)),
             wx.VERTICAL)
     grdSizer = wx.GridSizer(2,4,vgap=3,hgap = 3)
     bx2=wx.BoxSizer(wx.HORIZONTAL)
     for i in range(len(parent.groupes[gr][1:])):
         n=parent.groupes[gr][i+1]
         nomCourt = gr[:2]+'_'+n;nom = gr+'_'+n;
         if n=='Type':
             but = wx.Button(self, parent.numBouton,parent.traduit("Type de Modele"),name=nom)
             bxSizer.Add(but, 0) #,wx.EXPAND)
             bxSizer.AddSpacer((0,5), 0)
             wx.EVT_BUTTON(self, parent.numBouton, parent.OnButton)
         elif n[:2]=='V_':
             s1=wx.BoxSizer(wx.HORIZONTAL)
             tx1=wx.StaticText(self,-1,parent.traduit('Var.'))
             n='Variable';liste = parent.model.getParm(gr,n);nom=gr+'_'+n
             chlist=[parent.traduit(n) for n in liste]
             choix = wx.Choice(self, parent.numBouton, choices=chlist, name=nom)
             wx.EVT_CHOICE(self, parent.numBouton, parent.OnButton)        
             parent.numBouton += 1
             s1.AddMany([(tx1,0),(choix,0)])
             s2=wx.BoxSizer(wx.HORIZONTAL)
             tx2=wx.StaticText(self,-1,parent.traduit('Backg.'))
             ti1 = " 0 ";n='ValBase';nomCourt = gr[:2]+'_'+n;nom=gr+'_'+n;
             vbase = wx.Button(self, parent.numBouton,ti1, name = nom, size = (50,20))        
             parent.numBouton += 1
             self.Bind(wx.EVT_BUTTON, parent.OnButton,vbase)
             s2.AddMany([(tx2,0),(vbase,0)])
             if gr=='Ecoulement':
                 parent.txtunit = wx.StaticText(self,-1,"",style = wx.ALIGN_CENTER_VERTICAL)
                 s2.Add(parent.txtunit,0)
             bxSizer.AddMany([(s1,5),(s2,5)])
         elif n=='Milieu':
             n='Milieux';liste = parent.model.getParm(gr,n);nom=gr+'_'+n;
             chlist=['z','n'];#[parent.traduit(n) for n in liste[1]]
             choix = wx.Choice(self, parent.numBouton, choices=chlist, name=nom)
             #if liste[0] in liste[1]:
             #    num=liste[1].index(liste[0]);choix.SetSelection(num)
             wx.EVT_CHOICE(self, parent.numBouton, parent.OnButton)        
             parent.numBouton += 1
             bx2.AddMany([(wx.StaticText(self,-1,parent.traduit('Milieu')),5),(choix,0)]) #,(parent.togBut,0)
         else :
             but = wx.BitmapButton(self,parent.numBouton,parent.icones[nomCourt],size=(25,24),name=nom)
             grdSizer.Add(but, 0);
             if parent.tipNames[gr][i+1]!='':
                 but.SetToolTipString(parent.traduit(parent.tipNames[gr][i+1]))
             wx.EVT_BUTTON(self, parent.numBouton, parent.OnButton)
         parent.numBouton += 1
     bxSizer.AddMany([(grdSizer, 0),(bx2,0)])
     self.SetSizer(bxSizer)
Exemplo n.º 4
0
    def dispose(self):
        """ Disposes of the contents of an editor.
        """
        # Make sure we aren't hanging on to any object refs:
        self._object_cache = None

        if self._ui is not None:
            self._ui.dispose()

        choice = self._choice
        if choice is not None:
            if isinstance(choice, wx.Choice):
                wx.EVT_CHOICE(choice, choice.GetId(), None)

            if self._object is not None:
                self._object.on_trait_change(self.rebuild_items,
                                             self._name,
                                             remove=True)
                self._object.on_trait_change(self.rebuild_items,
                                             self._name + '_items',
                                             remove=True)

            self.factory.on_trait_change(self.rebuild_items,
                                         'values',
                                         remove=True)
            self.factory.on_trait_change(self.rebuild_items,
                                         'values_items',
                                         remove=True)

        super(CustomEditor, self).dispose()
Exemplo n.º 5
0
 def createControl(self, parent, values, idx, sizeX, iec=None):
     self.editorCtrl = wx.Choice(parent, self.wID,
                                 wx.Point(-2, idx * oiLineHeight - 1),
                                 wx.Size(sizeX, oiLineHeight + 3), values)
     wx.EVT_CHOICE(self.editorCtrl, self.wID, self.OnSelect)
     InspectorEditorControl.createControl(self)
     self.iec = None
Exemplo n.º 6
0
 def create_control(self, parent):
     """ Creates the initial editor control.
     """
     self.control = wx.Choice(
         parent, -1, wx.Point(0, 0), wx.Size(100, 20), []
     )
     wx.EVT_CHOICE(parent, self.control.GetId(), self.update_object)
Exemplo n.º 7
0
    def __init__(self,owner,parent,pname,ptype,pvalue):
        if ptype in [2,4,5]:
            return
        wx.BoxSizer.__init__(self,wx.HORIZONTAL)
        self.owner = owner
        self.dataType = ptype
        self.parent = parent
        valid_types = [_('integer'),_('float'),_('string'),\
                                            _('object'),_('location')]
        self.control_memory = {self.dataType:pvalue}

        self.left_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.name_control = wx.TextCtrl(self.parent,-1)
        self.name_control.SetValue(pname)
        self.type_control = wx.Choice(self.parent,-1,\
                        choices=valid_types,style=wx.LB_SINGLE)
        self.type_control.SetSelection(self.dataType-1)
        
        self.left_sizer.Add(self.name_control,flag=wx.ALL,border=2)
        self.left_sizer.Add(self.type_control,\
                            flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL,border=2)

        wx.EVT_CHOICE(self.parent,self.type_control.GetId(),self.typeSelect)
        wx.EVT_TEXT(self.parent,self.name_control.GetId(),self.valueChanged)

        self.Add(self.left_sizer,wx.ALL,border=2)

        self.setDataControl()
Exemplo n.º 8
0
 def __init__(self,parent,gr,ig):
     wx.Panel.__init__(self,parent,-1) #,size=(-1,300))
     bxSizer=wx.StaticBoxSizer(wx.StaticBox(self, -1, str(ig+1)+'.'+gr), wx.VERTICAL)
     Ctrl = parent.groups[gr][1:]
     grdSizer = wx.FlexGridSizer(len(Ctrl),3,vgap=3,hgap=3)
     for n in Ctrl:
         if type(n)==type([1,2]): #cas liste -> choix
             name = gr+'_'+n[0]+'_L';
             text = wx.StaticText(self, -1, n[0])
             grdSizer.Add(text,0)
             liste = n[1]
             choix = wx.Choice(self, parent.numCtrl, choices=liste, name=name)
             grdSizer.Add(choix, 0)
             wx.EVT_CHOICE(self, parent.numCtrl, parent.OnClick)        
         else : # cas simple : checkbox
             name = gr+'_'+n+'_B';
             text = wx.StaticText(self, -1, n)
             grdSizer.Add(text, 0)
             chk = wx.CheckBox(self, parent.numCtrl, "",name=name)
             grdSizer.Add(chk, 0)
             wx.EVT_CHECKBOX(self, parent.numCtrl, parent.OnClick)
         but = wx.Button(self, parent.numCtrl+1,"C",name=name[:-2]+'_C',size=(16,16))
         grdSizer.Add(but, 0,wx.ALIGN_LEFT)
         wx.EVT_BUTTON(self, parent.numCtrl+1, parent.OnChange)
         if n in ['Map','Visible','Type','Zone']:but.Enable(False)
         if n[0] in ['Plane','Layer','Tstep','Units']:but.Enable(False)
         parent.numCtrl += 2
     bxSizer.Add(grdSizer, 0, wx.ALIGN_CENTER)
     self.SetSizer(bxSizer)
Exemplo n.º 9
0
    def _bindEvents(self):
        controlFrame = self.slice3dVWR.controlFrame

        wx.EVT_BUTTON(controlFrame, controlFrame.createSliceButtonId,
                      self._handlerCreateSlice)

        # for ortho view use sliceDirection.createOrthoView()

        wx.grid.EVT_GRID_CELL_RIGHT_CLICK(
            self._grid, self._handlerGridRightClick)
        wx.grid.EVT_GRID_LABEL_RIGHT_CLICK(
            self._grid, self._handlerGridRightClick)

        wx.grid.EVT_GRID_RANGE_SELECT(
            self._grid, self._handlerGridRangeSelect)

        # now do the fusion stuff
        wx.EVT_CHOICE(
            self.slice3dVWR.controlFrame,
            self.slice3dVWR.controlFrame.overlayModeChoice.GetId(),
            self._handlerOverlayModeChoice)

        wx.EVT_COMMAND_SCROLL(
            self.slice3dVWR.controlFrame,
            self.slice3dVWR.controlFrame.fusionAlphaSlider.GetId(),
            self._handlerFusionAlphaSlider)
Exemplo n.º 10
0
    def _createDialog(self):
        self.dlg = wx.Dialog(None, wx.NewId(), "Create edited Classifier")
        self.sizer = wx.FlexGridSizer(rows=0, cols=1)
        self.dlg.SetSizer(self.sizer)

        choiceSizer = wx.FlexGridSizer(rows=1, cols=0)
        statText = wx.StaticText(self.dlg, wx.NewId(),
                                 "Select an Editing Algorithm")
        choiceSizer.Add(statText,
                        flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                        border=10)
        choiceId = wx.NewId()
        choiceControl = wx.Choice(self.dlg,
                                  choiceId,
                                  choices=self._algoNames())
        wx.EVT_CHOICE(self.dlg, choiceId, self._choiceCallback)
        choiceSizer.Add(choiceControl, flag=wx.ALIGN_RIGHT)
        choiceSizer.AddGrowableCol(0)

        self.sizer.Add(choiceSizer, flag=wx.EXPAND | wx.ALL, border=10)
        self.sizer.Add(wx.StaticLine(self.dlg), flag=wx.EXPAND)

        self._replaceArgs()

        buttons = self.dlg.CreateButtonSizer(wx.OK | wx.CANCEL)
        #buttons.Realize() # does not work on Windows
        self.sizer.Add(buttons, flag=wx.ALL, border=10)

        self.sizer.Fit(self.dlg)
        self.sizer.SetSizeHints(self.dlg)
Exemplo n.º 11
0
 def getInfoPanel(self, parent):
     wx.StaticText(parent, -1, "Traffic ", wx.Point(5, 5))
     wx.StaticText(parent, -1, "   Name: " + self.getName(),
                   wx.Point(5, 20))
     wx.StaticText(parent, -1, "   Throughput: ", wx.Point(5, 35))
     wx.StaticText(parent, -1, "   Target: ", wx.Point(5, 64))
     tID = wx.NewId()
     choice = wx.Choice(parent,
                        tID,
                        wx.Point(100, 60),
                        size=wx.Size(105, 22),
                        choices=[])
     wx.EVT_CHOICE(parent, tID, self.assign)
     id = choice.Append(" <None> ")
     choice.SetClientData(id, None)
     choice.SetSelection(id)
     for item in self._ctrl.getClients():
         hostAssigned = self._ctrl.tree.GetPyData(
             self._ctrl.tree.GetItemParent(
                 self._ctrl.findTreeNode(self))).getAssignedClient()
         if hostAssigned == item[0]:
             continue
         id = choice.Append(str(item[1][1]))
         choice.SetClientData(id, item[0])
         if self._client == item[0]:
             choice.SetSelection(id)
     tID = wx.NewId()
     text = wx.TextCtrl(parent, tID, str(self._throughput),
                        wx.Point(100, 31), (105, -1))
     wx.EVT_TEXT(parent, text.GetId(), self.EvtText)
     wx.StaticText(parent, -1, "kb/s", wx.Point(210, 35))
Exemplo n.º 12
0
    def __init__(self, typeSpec, prop, propWindow, defaultlang=0):
        # the defaultlang parameter should be the BIOWARE code for the language
        # see file/Language or Bioware documentation for those codes
        wx.BoxSizer.__init__(self, wx.VERTICAL)

        langChoices = neveredit.file.Language.BIOorderedLangs
        genderChoices = ['Default', 'Female']

        # TODO change this to use some default value fetched from preferences
        self.langID = defaultlang
        self.gender = 0
        self.prop = prop

        insideHorizSizer = wx.BoxSizer(wx.VERTICAL)
        choiceSizer = wx.BoxSizer(wx.VERTICAL)

        if len(typeSpec) > 1 and int(typeSpec[1]) > 1:
            self.textCtrl = wx.TextCtrl(propWindow,
                                        -1,
                                        '',
                                        wx.DefaultPosition,
                                        (250, int(typeSpec[1]) * 24),
                                        style=wx.TE_MULTILINE)
        else:
            self.textCtrl = wx.TextCtrl(propWindow, -1, '', wx.DefaultPosition,
                                        (250, 24))


#        wx.EVT_TEXT(propWindow,self.textCtrl.GetId(),propWindow.controlUsed)
        self.Bind(wx.EVT_TEXT,
                  propWindow,
                  propWindow.controlUsed,
                  id=self.textCtrl.GetId())

        self.label = wx.StaticText(propWindow, -1, '')

        self.langIDChoice = wx.Choice(propWindow, -1, choices=langChoices)
        self.langIDChoice.SetSelection(
            neveredit.file.Language.convertFromBIOCode(self.langID))
        #        wx.EVT_CHOICE(propWindow,self.langIDChoice.GetId(),self.langSelection)
        self.Bind(wx.EVT_CHOICE,
                  propWindow,
                  self.langSelection,
                  id=self.langIDChoice.GetId())

        self.genderChoice = wx.Choice(propWindow, -1, choices=genderChoices)
        self.genderChoice.SetSelection(self.gender)
        wx.EVT_CHOICE(propWindow, self.genderChoice.GetId(),
                      self.langSelection)
        #       self.Bind(wx.EVT_CHOICE,propWindow,self.langSelection,id=self.genderChoice.GetId())

        choiceSizer.Add(self.langIDChoice, 0, wx.ALL, 5)
        choiceSizer.Add(self.genderChoice, 0, wx.ALL, 5)

        self.fetchText()

        insideHorizSizer.Add(self.textCtrl, 0, wx.EXPAND | wx.ALL, 0)
        insideHorizSizer.Add(choiceSizer)
        self.Add(self.label, 0, wx.ALL, 5)
        self.Add(insideHorizSizer, 0, wx.EXPAND | wx.ALL, 0)
Exemplo n.º 13
0
    def init(self, parent):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        super(SimpleEditor, self).init(parent)

        factory = self.factory

        if factory.evaluate is None:
            self.control = control = wx.Choice(parent, -1, wx.Point(0, 0),
                                               wx.Size(-1, -1), self.names)
            wx.EVT_CHOICE(parent, self.control.GetId(), self.update_object)
        else:
            self.control = control = wx.ComboBox(parent,
                                                 -1,
                                                 '',
                                                 wx.Point(0, 0),
                                                 wx.Size(-1, -1),
                                                 self.names,
                                                 style=wx.CB_DROPDOWN)
            wx.EVT_COMBOBOX(parent, control.GetId(), self.update_object)
            wx.EVT_TEXT_ENTER(parent, control.GetId(), self.update_text_object)
            wx.EVT_KILL_FOCUS(control, self.on_kill_focus)

            if (not factory.is_grid_cell) and factory.auto_set:
                wx.EVT_TEXT(parent, control.GetId(), self.update_text_object)

        self._no_enum_update = 0
        self.set_tooltip()
Exemplo n.º 14
0
    def setup(self, parent):
        """
        Creates all the controls in the panel
        """
        super(XYSeriesFittingControls, self).setup(parent)

        data_selection_static_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, 'Data selection'), wx.VERTICAL)

        self.selection_panel = data_selection.DataRangeSelectionPanel(
            self, self.series)

        data_selection_static_sizer.Add(self.selection_panel, 1, wx.EXPAND)
        self.Add(data_selection_static_sizer,
                 0,
                 wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL,
                 border=5)

        fit_type_static_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, 'Fitting'), wx.VERTICAL)

        self.fit_type = wx.Choice(
            self,
            wx.ID_ANY,
            choices=[ft.name for ft in fitting.get_fitting_tools()])
        fit_type_static_sizer.Add(self.fit_type, 1, wx.ALIGN_RIGHT)
        fit_button = wx.Button(self, -1, "Fit")
        fit_type_static_sizer.Add(fit_button, 0,
                                  wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)
        self.Add(fit_type_static_sizer,
                 0,
                 wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL,
                 border=5)

        wx.EVT_BUTTON(self, fit_button.GetId(), self.on_fit)
        wx.EVT_CHOICE(self, self.fit_type.GetId(), self.on_tool_choice)

        stats_static_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, 'Statistics'), wx.VERTICAL)
        self.samples_txt = wx.StaticText(self, wx.ID_ANY, "\tNum. Samples:")
        self.mean_txt = wx.StaticText(self, wx.ID_ANY, "\tMean:")
        self.stddev_txt = wx.StaticText(self, wx.ID_ANY, "\tStd. Dev.:")
        self.min_txt = wx.StaticText(self, wx.ID_ANY, "\tMin. Value:")
        self.max_txt = wx.StaticText(self, wx.ID_ANY, "\tMax. Value:")
        stats_static_sizer.Add(self.samples_txt, 0, wx.ALIGN_LEFT)
        stats_static_sizer.Add(self.mean_txt, 0, wx.ALIGN_LEFT)
        stats_static_sizer.Add(self.stddev_txt, 0, wx.ALIGN_LEFT)
        stats_static_sizer.Add(self.min_txt, 0, wx.ALIGN_LEFT)
        stats_static_sizer.Add(self.max_txt, 0, wx.ALIGN_LEFT)
        self.calc_button = wx.Button(self, wx.ID_ANY, "Calculate")
        stats_static_sizer.Add(self.calc_button, 0, wx.ALIGN_CENTER_HORIZONTAL)
        self.Add(stats_static_sizer,
                 0,
                 wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL,
                 border=5)

        wx.EVT_BUTTON(self, self.calc_button.GetId(), self.on_calculate)

        self.span = None
Exemplo n.º 15
0
    def __init__(self, parent, label, current_selection, selections, callback):
        SettingBase.__init__(self, parent, label)

        lb = wx.Choice(parent, -1, choices=selections)
        self.Add(lb, 0, wx.ALIGN_CENTRE_VERTICAL | wx.ALIGN_LEFT)
        lb.SetStringSelection(current_selection)

        wx.EVT_CHOICE(parent, lb.GetId(), callback)
Exemplo n.º 16
0
    def OnInit(self):
        """Initialize the :py:class:`MyApp` instance; start by loading
        the xrc resource file and then add other stuff and bind the events"""
        xrcfile = '/Users/kraussry/git/wxpython_guis/lab_prep_xrc_GVSU.xrc'
        self.res = xrc.XmlResource(xrcfile)

        # main frame and panel ---------

        self.frame = self.res.LoadFrame(None,"main_frame")
        self.panel = xrc.XRCCTRL(self.frame,"main_panel")

        self.coursechoice = xrc.XRCCTRL(self.frame,"course_choice")
        self.coursechoice.SetStringSelection('345')
        self.lab_number_box = xrc.XRCCTRL(self.frame,"lab_number_box")
        self.root_folder_box = xrc.XRCCTRL(self.frame,"root_folder_box")
        self.root_browse = xrc.XRCCTRL(self.frame, "root_browse")
        self.go_button = xrc.XRCCTRL(self.frame, "go_button")
        self.next_button = xrc.XRCCTRL(self.frame, "next_button")
        self.lab_title_box = xrc.XRCCTRL(self.frame, "lab_title_box")
        self.lab_title_box.SetFocus()
        
        wx.EVT_CHOICE(self.coursechoice, self.coursechoice.GetId(), \
                      self.on_course_choice)
        wx.EVT_BUTTON(self.root_browse, self.root_browse.GetId(), \
                      self.on_browse)
        wx.EVT_BUTTON(self.go_button, self.go_button.GetId(), \
                      self.go)
        wx.EVT_BUTTON(self.next_button, self.next_button.GetId(), \
                      self.next_lab)

        self.menubar = self.frame.GetMenuBar()
        ## self.frame.Bind(wx.EVT_MENU, self.on_exit, \
        ##                 id=xrc.XRCID('quit_menu_item'))

        self.frame.Bind(wx.EVT_MENU, self.go, \
                        id=xrc.XRCID('menu_go'))
        self.frame.Bind(wx.EVT_ACTIVATE, self.OnActivate)
        
        # set up accelerators
        accelEntries = []
        accelEntries.append((wx.ACCEL_CTRL, ord('G'), xrc.XRCID("menu_go")))

        accelTable  = wx.AcceleratorTable(accelEntries)
        self.frame.SetAcceleratorTable(accelTable)


        ## self.frame.Bind(wx.EVT_MENU, self.load, \
        ##         id=xrc.XRCID('load_menu_item'))

        self.my_init()
        # Intial debugging
        #L4title = "Open-Loop DC Motor Control"
        #self.lab_title_box.SetValue(L4title)
        self.frame.SetClientSize((625,300))
        self.frame.Show(1)
        self.SetTopWindow(self.frame)
        return True
Exemplo n.º 17
0
 def init(self, parent):
     """ Finishes initializing the editor by creating the underlying toolkit
         widget.
     """
     self.control = wx.Choice(parent, -1, wx.Point(0, 0),
                              wx.Size(self.width, 20),
                              self.model.get_labels())
     wx.EVT_CHOICE(parent, self.control.GetId(), self.update_object)
     self.update_editor()
Exemplo n.º 18
0
    def SetupToolBar(self):
        """Create the toolbar for common actions"""
        tb = self.CreateToolBar(self.TBFLAGS)
        tsize = (24, 24)
        tb.ToolBitmapSize = tsize
        open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR,
                                            tsize)
        tb.AddLabelTool(ID_OPEN,
                        "Open",
                        open_bmp,
                        shortHelp="Open",
                        longHelp="Open a (c)Profile trace file")
        if not osx:
            tb.AddSeparator()


#        self.Bind(wx.EVT_TOOL, self.OnOpenFile, id=ID_OPEN)
        self.rootViewTool = tb.AddLabelTool(
            ID_ROOT_VIEW,
            _("Root View"),
            wx.ArtProvider.GetBitmap(wx.ART_GO_HOME, wx.ART_TOOLBAR, tsize),
            shortHelp=_(
                "Display the root of the current view tree (home view)"))
        self.rootViewTool = tb.AddLabelTool(
            ID_BACK_VIEW,
            _("Back"),
            wx.ArtProvider.GetBitmap(wx.ART_GO_BACK, wx.ART_TOOLBAR, tsize),
            shortHelp=_(
                "Back to the previously activated node in the call tree"))
        self.upViewTool = tb.AddLabelTool(
            ID_UP_VIEW,
            _("Up"),
            wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_TOOLBAR, tsize),
            shortHelp=_(
                "Go one level up the call tree (highest-percentage parent)"))
        if not osx:
            tb.AddSeparator()
        # TODO: figure out why the control is sizing the label incorrectly on Linux
        self.percentageViewTool = wx.CheckBox(tb, -1, _("Percent    "))
        self.percentageViewTool.SetToolTip(
            wx.ToolTip(_("Toggle display of percentages in list views")))
        tb.AddControl(self.percentageViewTool)
        wx.EVT_CHECKBOX(self.percentageViewTool,
                        self.percentageViewTool.GetId(), self.OnPercentageView)

        self.viewTypeTool = wx.Choice(tb,
                                      -1,
                                      choices=getattr(self.loader, 'ROOTS',
                                                      []))
        self.viewTypeTool.SetToolTip(
            wx.ToolTip(
                _("Switch between different hierarchic views of the data")))
        wx.EVT_CHOICE(self.viewTypeTool, self.viewTypeTool.GetId(),
                      self.OnViewTypeTool)
        tb.AddControl(self.viewTypeTool)
        tb.Realize()
Exemplo n.º 19
0
    def __init__(self, parent, monitor):
        self.method = 'auto'
        self.nPoints = 8
        assert isinstance(monitor, monitors.Monitor)
        self.useBits = monitor.getUseBits()

        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           'Gamma Calibration',
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        mainSizer = wx.FlexGridSizer(cols=2, hgap=1, vgap=1)

        #select method of calib (auto, semi-auto, manual)
        #todo: make the input  tablefor manual method
        self.methodChoiceBx = wx.Choice(self, -1, choices=['auto', 'semi'])
        self.methodChoiceBx.SetStringSelection('auto')
        wx.EVT_CHOICE(self, self.methodChoiceBx.GetId(), self.onMethodChange)

        self.ctrlUseBits = wx.CheckBox(self, -1, 'Use Bits++')
        self.ctrlUseBits.SetValue(self.useBits)

        self.labelNPoints = wx.StaticText(self, -1,
                                          'Number of calibration points:')
        self.ctrlNPoints = wx.Choice(self,
                                     -1,
                                     choices=[
                                         '3', '4', '5', '6', '7', '8', '10',
                                         '16', '48', '64', '256'
                                     ])
        self.ctrlNPoints.SetStringSelection('8')

        self.labelStimSize = wx.StaticText(self, -1,
                                           'Patch size (fract of screen):')
        self.ctrlStimSize = wx.TextCtrl(self, -1, '0.3')

        pad = 5
        mainSizer.Add((0, 0), 1, wx.ALL, pad)
        mainSizer.Add(self.methodChoiceBx, 1, wx.ALL, pad)
        mainSizer.Add(self.labelNPoints, 1, wx.ALL, pad)
        mainSizer.Add(self.ctrlNPoints, 1, wx.ALL, pad)
        mainSizer.Add(self.labelStimSize, 1, wx.ALL, pad)
        mainSizer.Add(self.ctrlStimSize, 1, wx.ALL, pad)
        mainSizer.Add((0, 0), 1, wx.ALL, pad)
        mainSizer.Add(self.ctrlUseBits, 1, wx.ALL, pad)

        btnOK = wx.Button(self, wx.ID_OK, " OK ")
        btnOK.SetDefault()
        mainSizer.Add(btnOK, 1, wx.TOP | wx.BOTTOM | wx.ALIGN_RIGHT, pad)
        btnCANC = wx.Button(self, wx.ID_CANCEL, " Cancel ")
        mainSizer.Add(btnCANC, 1,
                      wx.TOP | wx.BOTTOM | wx.RIGHT | wx.ALIGN_RIGHT, pad)
        self.Center()
        #mainSizer.Fit(self)
        self.SetAutoLayout(True)
        self.SetSizerAndFit(mainSizer)
Exemplo n.º 20
0
    def __init__(self, parent):
        p = wx.PrePanel()
        self.PostCreate(p)

        res = wx.xrc.XmlResource.Get()
        res.LoadOnPanel(self, parent, "ExportSubMultipageText")

        self.ctrls = XrcControls(self)

        wx.EVT_CHOICE(self, GUI_ID.chFileVersion, self.OnFileVersionChoice)
Exemplo n.º 21
0
    def init_advanved_dose(self):
        self.drop_projectile = XRCCTRL(self, "drop_projectile")
        self.drop_projectile.Append("H")
        self.drop_projectile.Append("C")

        self.txt_dose_percent = XRCCTRL(self, "txt_dose_percent")
        wx.EVT_BUTTON(self, XRCID('btn_set_dosepercent'),
                      self.set_dose_percent)
        wx.EVT_CHOICE(self, XRCID('drop_projectile'),
                      self.on_projectile_changed)
Exemplo n.º 22
0
    def init(self, parent):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        # Create a panel to hold all of the buttons:
        self.control = panel = TraitsUIPanel(parent, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)

        # Add all of the font choice controls:
        sizer2 = wx.BoxSizer(wx.HORIZONTAL)
        facenames = self.factory.all_facenames()
        control = self._facename = wx.Choice(panel, -1, wx.Point(0, 0),
                                             wx.Size(-1, -1), facenames)

        sizer2.Add(control, 4, wx.EXPAND)
        wx.EVT_CHOICE(panel, control.GetId(), self.update_object_parts)

        control = self._point_size = wx.Choice(panel, -1, wx.Point(0, 0),
                                               wx.Size(-1, -1), PointSizes)
        sizer2.Add(control, 1, wx.EXPAND | wx.LEFT, 3)
        wx.EVT_CHOICE(panel, control.GetId(), self.update_object_parts)

        if self.factory.show_style:
            self._style = wx.Choice(panel, -1, wx.Point(0, 0), wx.Size(-1, -1),
                                    Styles)
            sizer2.Add(self._style, 1, wx.EXPAND | wx.LEFT, 3)
            wx.EVT_CHOICE(panel, self._style.GetId(), self.update_object_parts)

        if self.factory.show_weight:
            self._weight = wx.Choice(panel, -1, wx.Point(0, 0),
                                     wx.Size(-1, -1), Weights)
            sizer2.Add(self._weight, 1, wx.EXPAND | wx.LEFT, 3)
            wx.EVT_CHOICE(panel, self._weight.GetId(),
                          self.update_object_parts)

        sizer.Add(sizer2, 0, wx.EXPAND)

        # Set-up the layout:
        panel.SetSizer(sizer)

        self.set_tooltip()
Exemplo n.º 23
0
    def __init__(self,
                 parent,
                 id,
                 title,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_DIALOG_STYLE):
        wx.Dialog.__init__(self, parent, id, title, pos, size, style)

        # WDR: handler declarations for MyDialog
        wx.EVT_CHOICE(self, ID_CHOICE, self.OnChoice)
        self.sizer = TestDialogFunc(self)
        self.SetSizer(self.sizer)
        self.GetSizer().Fit(self)
    def __init__(self,
                 pWiki,
                 ID,
                 imgpastesaver,
                 img,
                 title=None,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize):
        d = wx.PreDialog()
        self.PostCreate(d)

        self.pWiki = pWiki
        res = wx.xrc.XmlResource.Get()
        res.LoadOnDialog(self, self.pWiki, "ImagePasteDialog")

        self.ctrls = XrcControls(self)

        if title is not None:
            self.SetTitle(title)

        self.ctrls.tfEditorImagePasteFilenamePrefix.SetValue(
            imgpastesaver.prefix)
        self.ctrls.chEditorImagePasteFileType.SetSelection(
            imgpastesaver.formatNo)
        self.ctrls.tfEditorImagePasteQuality.SetValue(
            unicode(imgpastesaver.quality))

        self.origImage = img
        self.origImgWidth, self.origImgHeight = img.GetSize()

        self.bitmapControl = wx.StaticBitmap(
            self.ctrls.pnImagePreviewContainer, -1, wx.NullBitmap)

        self.imgpastesaver = ImagePasteSaver()

        self.ctrls.btnOk.SetId(wx.ID_OK)
        self.ctrls.btnCancel.SetId(wx.ID_CANCEL)

        self.OnFileTypeChoice(None)
        self.OnSizePreviewBitmapContainer(None)

        # Fixes focus bug under Linux
        self.SetFocus()

        wx.EVT_BUTTON(self, wx.ID_OK, self.OnOk)
        wx.EVT_CHOICE(self, GUI_ID.chEditorImagePasteFileType,
                      self.OnFileTypeChoice)

        wx.EVT_SIZE(self.ctrls.pnImagePreviewContainer,
                    self.OnSizePreviewBitmapContainer)
Exemplo n.º 25
0
 def __init__(self, FileName):
     wx.Dialog.__init__(self, None, title="Importing a CSV file",\
             size=(600,470))
     self.FileName = FileName
     self.decider = wx.Notebook(self, -1, pos=(10,0), \
             size=(580,240), style=wx.NB_TOP)
     self.p1 = PanelDelimiter(self.decider, self.FileName.fileName)
     self.p2 = PanelFixedWidth(self.decider, self.FileName.fileName)
     self.decider.AddPage(self.p1, "Delimited files")
     self.decider.AddPage(self.p2, "Fixed width files")
     t1 = wx.StaticText(self, -1, label="Import from row:", pos=(245, 250))
     self.headerRow = wx.CheckBox(self, 760, " Header on first row", \
             pos=(430,250))
     self.dataRow = wx.SpinCtrl(self,766,min=1,max=100, initial=1, \
             pos=(365,250),size=(50,-1))
     self.dataRow.SetValue(1)
     self.buttonImport = wx.Button(self,763,"Import", \
             pos=(500,400),size=(70,-1))
     self.buttonImport.SetDefault()
     self.buttonCancel = wx.Button(self,764,"Cancel", \
             pos=(405,400),size=(70,-1))
     self.grid = gridlib.Grid(self, -1, size=(560, 100), pos=(20, 290))
     #self.grid.HideRowLabels()
     self.MaxRows = 100
     self.MaxCols = 8
     self.grid.SetColLabelSize(16)
     self.grid.SetRowLabelSize(40)
     self.grid.SetDefaultColSize(60)
     self.grid.CreateGrid(self.MaxRows, self.MaxCols)
     for i in range(8):
         self.grid.SetRowSize(i, 16)
         self.grid.SetColLabelValue(i, " ")
     self.gridFont = wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL)
     self.grid.SetDefaultCellFont(self.gridFont)
     lineEndChoices = [
         'Not sure', '\\n (Unix)', '\\r\\n (Windows)', '\\r (old Mac)'
     ]
     t3 = wx.StaticText(self, -1, "Line ending:", pos=(20, 250))
     self.lineEnd = wx.Choice(self, 765,pos=(105,248),size=(120,-1),\
             choices = lineEndChoices)
     self.AttemptPreview()
     # It seems odd but it seems better for all events to be routed to the same method
     wx.EVT_CHECKBOX(self, 760, self.AttemptPreview)
     wx.EVT_TEXT(self, 761, self.AttemptPreview)
     wx.EVT_TEXT(self, 762, self.AttemptPreview)
     wx.EVT_BUTTON(self, 764, self.CancelButton)
     wx.EVT_BUTTON(self, 763, self.ImportButton)
     wx.EVT_CHOICE(self, 765, self.AttemptPreview)
     wx.EVT_SPINCTRL(self, 766, self.AttemptPreview)
Exemplo n.º 26
0
 def __init__(self, prop, propWindow,choices,twodaName):
     wx.BoxSizer.__init__(self,wx.HORIZONTAL)
     self.play_button = wx.Button(propWindow,-1,_('play'))
     self.sound_list = wx.Choice(propWindow,-1,choices=choices)
     self.twodaName = twodaName
     self.twoda = neverglobals.getResourceManager().getResourceByName(twodaName)
     self.parent = propWindow
     self.Add(self.sound_list)
     self.Add(self.play_button)
     wx.EVT_CHOICE(propWindow,self.sound_list.GetId(),self.soundChanged)
     wx.EVT_BUTTON(propWindow,self.play_button.GetId(),self.playButtonHit)
     self.SoundType = None
     self.SoundObject = None
     self.hasChanged = False
     self.firstTime = True
Exemplo n.º 27
0
 def getInfoPanel(self, parent):
     wx.StaticText(parent, -1, "Host ", wx.Point(5,5))
     wx.StaticText(parent, -1, "   Name: " + self.getName(), wx.Point(5,20))
     wx.StaticText(parent, -1, "   Assigned to: ", wx.Point(5,39))
     tID = wx.NewId()
     choice = wx.Choice(parent, tID, wx.Point(100, 35), size = wx.Size(105, 22), choices = [])
     wx.EVT_CHOICE(parent, tID, self.assign)
     id = choice.Append(" <None> ")
     choice.SetClientData(id, None)
     choice.SetSelection(id)
     for item in self._ctrl.getClients():
         id = choice.Append(str(item[1][1]))
         choice.SetClientData(id, item[0])
         if self._client == item[0]:
             choice.SetSelection(id)
Exemplo n.º 28
0
    def Init(self, voi):
        self.voi = voi

        wx.EVT_BUTTON(self, XRCID('btn_ok'), self.save_and_close)
        wx.EVT_BUTTON(self, XRCID('btn_close'), self.close)

        self.label_name = XRCCTRL(self, "label_name")
        self.label_name.SetLabel(voi.get_name())

        self.txt_dose = XRCCTRL(self, "txt_dose")
        self.txt_dose.SetValue("%.2f" % (voi.get_dose()))

        self.check_target = XRCCTRL(self, "check_target")
        self.check_target.SetValue(voi.is_target())
        self.check_target.Bind(wx.EVT_CHECKBOX, self.on_check_target_changed)

        self.check_oar = XRCCTRL(self, "check_oar")
        self.check_oar.SetValue(voi.is_oar())
        self.check_oar.Bind(wx.EVT_CHECKBOX, self.on_check_oar_changed)

        self.txt_max_dose_fraction = XRCCTRL(self, "txt_max_dose_fraction")
        self.txt_max_dose_fraction.SetValue("%.2f" % (voi.get_max_dose_fraction()))

        self.txt_max_dose_fraction.Enable(False)
        self.txt_dose.Enable(False)
        if voi.is_target():
            self.check_oar.Enable(False)
            self.txt_dose.Enable(True)

        if voi.is_oar():
            self.txt_max_dose_fraction.Enable(True)
            self.check_target.Enable(False)

        self.txt_hu_value = XRCCTRL(self, "txt_hu_value")
        self.txt_hu_offset = XRCCTRL(self, "txt_hu_offset")
        if not voi.get_hu_value() is None:
            self.txt_hu_value.SetValue("%d" % voi.get_hu_value())
        if not voi.get_hu_offset() is None:
            self.txt_hu_offset.SetValue("%d" % voi.get_hu_offset())

        self.drop_projectile = XRCCTRL(self, "drop_projectile")
        self.drop_projectile.Append("H")
        self.drop_projectile.Append("C")

        self.txt_dose_percent = XRCCTRL(self, "txt_dose_percent")
        wx.EVT_BUTTON(self, XRCID('btn_set_dosepercent'), self.set_dose_percent)
        wx.EVT_CHOICE(self, XRCID('drop_projectile'), self.on_projectile_changed)
Exemplo n.º 29
0
    def OnInit(self):
        """Initialize the :py:class:`MyApp` instance; start by loading
        the xrc resource file and then add other stuff and bind the events"""
        xrcfile = 'course_prep_xrc2.xrc'
        self.res = xrc.XmlResource(xrcfile)

        # main frame and panel ---------

        self.frame = self.res.LoadFrame(None, "main_frame")
        self.panel = xrc.XRCCTRL(self.frame, "main_panel")

        self.coursechoice = xrc.XRCCTRL(self.frame, "course_choice")
        self.lecture_number_box = xrc.XRCCTRL(self.frame, "lecture_number_box")
        self.root_folder_box = xrc.XRCCTRL(self.frame, "root_folder_box")
        self.root_browse = xrc.XRCCTRL(self.frame, "root_browse")
        self.go_button = xrc.XRCCTRL(self.frame, "go_button")
        self.next_button = xrc.XRCCTRL(self.frame, "next_button")
        self.lecture_title_box = xrc.XRCCTRL(self.frame, "lecture_title_box")

        wx.EVT_CHOICE(self.coursechoice, self.coursechoice.GetId(), \
                      self.on_course_choice)
        wx.EVT_BUTTON(self.root_browse, self.root_browse.GetId(), \
                      self.on_browse)
        wx.EVT_BUTTON(self.go_button, self.go_button.GetId(), \
                      self.go)
        wx.EVT_BUTTON(self.next_button, self.next_button.GetId(), \
                      self.next_lecture)

        self.menubar = self.frame.GetMenuBar()
        ## self.frame.Bind(wx.EVT_MENU, self.on_exit, \
        ##                 id=xrc.XRCID('quit_menu_item'))

        self.frame.Bind(wx.EVT_MENU, self.save, \
                        id=xrc.XRCID('menu_save'))
        self.frame.Bind(wx.EVT_MENU, self.load, \
                        id=xrc.XRCID('menu_load'))

        ## self.frame.Bind(wx.EVT_MENU, self.load, \
        ##         id=xrc.XRCID('load_menu_item'))

        self.my_init()
        self.frame.SetClientSize((625, 300))
        self.frame.Show(1)
        self.SetTopWindow(self.frame)
        return True
Exemplo n.º 30
0
    def __init__(self, *args, **kwargs):
        super(SyncMLAccessPage, self).__init__(*args, **kwargs)

        choice = self.addChoiceSetting(
            None, 'preset', _('SyncML server'), '',
            [('0', _('Custom')), ('1', _('MemoToo (http://www.memotoo.com/)')),
             ('2', _('Horde-based'))])[0]
        wx.EVT_CHOICE(choice, wx.ID_ANY, self.OnPresetChanged)

        self.addTextSetting('access', 'syncUrl', _('SyncML server URL'))
        self.addTextSetting('access', 'username', _('User name/ID'))

        checkBox = self.addBooleanSetting('task', 'dosync',
                                          _('Enable tasks synchronization'))
        wx.EVT_CHECKBOX(checkBox, wx.ID_ANY, self.OnSyncTaskChanged)
        self.addTextSetting('task', 'uri', _('Tasks database name'))
        self.addChoiceSetting(
            'task', 'preferredsyncmode', _('Preferred synchronization mode'),
            '', [('TWO_WAY', _('Two way')), ('SLOW', _('Slow')),
                 ('ONE_WAY_FROM_CLIENT', _('One way from client')),
                 ('REFRESH_FROM_CLIENT', _('Refresh from client')),
                 ('ONE_WAY_FROM_SERVER', _('One way from server')),
                 ('REFRESH_FROM_SERVER', _('Refresh from server'))])
        self.enableTextSetting('task', 'uri',
                               self.getboolean('task', 'dosync'))
        self.enableChoiceSetting('task', 'preferredsyncmode',
                                 self.getboolean('task', 'dosync'))

        checkBox = self.addBooleanSetting('note', 'dosync',
                                          _('Enable notes synchronization'))
        wx.EVT_CHECKBOX(checkBox, wx.ID_ANY, self.OnSyncNoteChanged)
        self.addTextSetting('note', 'uri', _('Notes database name'))
        self.addChoiceSetting(
            'note', 'preferredsyncmode', _('Preferred synchronization mode'),
            '', [('TWO_WAY', _('Two way')), ('SLOW', _('Slow')),
                 ('ONE_WAY_FROM_CLIENT', _('One way from client')),
                 ('REFRESH_FROM_CLIENT', _('Refresh from client')),
                 ('ONE_WAY_FROM_SERVER', _('One way from server')),
                 ('REFRESH_FROM_SERVER', _('Refresh from server'))])
        self.enableTextSetting('note', 'uri',
                               self.getboolean('note', 'dosync'))
        self.enableChoiceSetting('note', 'preferredsyncmode',
                                 self.getboolean('note', 'dosync'))

        self.fit()