Пример #1
0
 def create_widget(self):
     try:
         self.widget = wx.SpinButton(self.parent.widget,
                                     self.id,
                                     style=self.style)
     except AttributeError:
         self.widget = wx.SpinButton(self.parent.widget, self.id)
Пример #2
0
    def __init__(self, parent, month=None, day=None, year=None):
        wx.Dialog.__init__(self, parent, -1, "Event Calendar",
                           wx.DefaultPosition, (280, 360))
        self.result = None

        # set the calendar and attributes
        self.calend = Calendar(self, -1, (20, 60), (240, 200))

        if month == None:
            self.calend.SetCurrentDay()
            start_month = self.calend.GetMonth()
            start_year = self.calend.GetYear()
        else:
            self.calend.month = start_month = month
            self.calend.year = start_year = year
            self.calend.SetDayValue(day)

        self.calend.HideTitle()
        self.ResetDisplay()

        # get month list from DateTime
        monthlist = GetMonthList()

        # select the month
        self.date = wx.ComboBox(self, -1, Month[start_month], (20, 20),
                                (90, -1), monthlist, wx.CB_DROPDOWN)
        self.Bind(wx.EVT_COMBOBOX, self.EvtComboBox, self.date)

        # alternate spin button to control the month
        h = self.date.GetSize().height
        self.m_spin = wx.SpinButton(self, -1, (115, 20), (h * 1.5, h),
                                    wx.SP_VERTICAL)
        self.m_spin.SetRange(1, 12)
        self.m_spin.SetValue(start_month)
        self.Bind(wx.EVT_SPIN, self.OnMonthSpin, self.m_spin)

        # spin button to control the year
        self.dtext = wx.TextCtrl(self, -1, str(start_year), (160, 20),
                                 (60, -1))
        h = self.dtext.GetSize().height

        self.y_spin = wx.SpinButton(self, -1, (225, 20), (h * 1.5, h),
                                    wx.SP_VERTICAL)
        self.y_spin.SetRange(1980, 2010)
        self.y_spin.SetValue(start_year)

        self.Bind(wx.EVT_SPIN, self.OnYrSpin, self.y_spin)
        self.Bind(EVT_CALENDAR, self.MouseClick, self.calend)

        x_pos = 50
        y_pos = 280
        but_size = (60, 25)

        btn = wx.Button(self, wx.ID_OK, ' Ok ', (x_pos, y_pos), but_size)
        self.Bind(wx.EVT_BUTTON, self.OnOk, btn)

        btn = wx.Button(self, wx.ID_CANCEL, ' Close ', (x_pos + 120, y_pos),
                        but_size)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, btn)
Пример #3
0
	def __init__(self, parent, frame_id):
		wx.Dialog.__init__(self, parent, frame_id, "Jadwal (Schedule)", size=(500,500))
		self.db = dbutil.MySQL('localhost', 'root', 'k4g4t4u', 'lampu')
		panel = wx.Panel(self)
		
		self.list_ctrlone = wx.ListCtrl(panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
		self.list_ctrlone.InsertColumn(0, "No", width=30)
		self.list_ctrlone.InsertColumn(1, "Id Jadwal", width=100)
		self.list_ctrlone.InsertColumn(2, "Hari", width=100)
		self.list_ctrlone.InsertColumn(3, "Mulai", width=100)
		self.list_ctrlone.InsertColumn(4, "Selesai", width=100)
		self.list_ctrlone.Show(True)
		self.isilistctrl()
		
		self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._is_selected, self.list_ctrlone)
		hari = ['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu']
		
		self.frmLbl = wx.StaticText(panel, -1, "Jadwal (Schedule)")
		self.frmLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
		
		self.lbIdJadwal= wx.StaticText(panel, -1, "Id_Jadwal ")
		self.inIdJadwal = wx.TextCtrl(panel, -1, size=(90, 25),validator = ValidasiInput("angka_saja"))
		self.lbNmJadwal = wx.StaticText(panel, -1, "Hari ")
		self.inNmJadwal = wx.ComboBox(panel, -1, "", size=(150, 25),choices=hari, style=wx.CB_READONLY)
		
		self.lbMulai = wx.StaticText(panel, -1, "Mulai ")
		self.spin1 = wx.SpinButton( panel, -1)
		self.inMulai = masked.TimeCtrl(panel, -1, name="24 hour control", fmt24hr=True,	spinButton = self.spin1)
		
		self.lbSelesai = wx.StaticText(panel, -1, "Selesai ")
		self.spin2 = wx.SpinButton(panel, -1)
		self.inSelesai = masked.TimeCtrl(panel, -1, name="24 hour control", fmt24hr=True,spinButton = self.spin2)
		
		self.inIdJadwal.SetInsertionPoint(0)
		self.AutoIncrementIdJadwal()
		#---button
		self.BtnSave = wx.Button(panel, -1, "Simpan")        
		self.Bind(wx.EVT_BUTTON, self.save, self.BtnSave)
		self.BtnClear = wx.Button(panel, -1, "Bersih")        
		self.Bind(wx.EVT_BUTTON, self.clear, self.BtnClear)
		
		#mengumpulkan semua textctrl
		self._all_textCtrl = [self.inIdJadwal, self.inNmJadwal, self.inMulai, self.inSelesai]
		
		self.MainLayer = wx.BoxSizer(wx.VERTICAL)
		self.entrySizer = wx.BoxSizer(wx.VERTICAL)
		self.stextSz = wx.FlexGridSizer(cols = 2, hgap = 5, vgap = 5)
		self.stextSz.AddGrowableCol(1)
		self.btnSizer= wx.BoxSizer(wx.HORIZONTAL)
		self.mulai= wx.BoxSizer(wx.HORIZONTAL)
		self.selesai= wx.BoxSizer(wx.HORIZONTAL)
		
		self.MainLayer.Fit(self)
		self.MainLayer.SetSizeHints(self)
		panel.SetSizer(self.MainLayer)
		
		self.aturSizer(panel)
Пример #4
0
 def __init__(self, parent, x, y):
     # self.text="";
     self.holidays = {
         1: [1],
         2: [13],
         3: [22],
         4: [3],
         5: [29],
         6: [15],
         7: [4, 11],
         8: [],
         9: [3],
         10: [],
         11: [27, 26],
         12: [24, 25]
     }
     wx.Dialog.__init__(self,
                        parent,
                        -1,
                        pos=(x, y),
                        size=(191, 205),
                        style=wx.FRAME_TOOL_WINDOW)
     self.cal = wx.lib.calendar.Calendar(self,
                                         -1,
                                         pos=(0, 30),
                                         size=(190, 172))
     start_month = self.cal.GetMonth()
     start_year = self.cal.GetYear()
     self.SetBackgroundColour("white")
     self.cal.SetWeekColor('white', 'pink')
     self.cal.SetColor(wx.lib.calendar.COLOR_WEEKEND_BACKGROUND, 'white')
     self.cal.ShowWeekEnd()
     self.set_days = self.holidays[start_month]
     self.cal.AddSelect(self.set_days, 'black', 'white')
     self.cal.Refresh()
     self.cal.HideTitle()
     self.Bind(wx.lib.calendar.EVT_CALENDAR, self.OnCalSelected)
     self.texty = wx.TextCtrl(self,
                              -1,
                              str(start_year),
                              pos=(2, 3),
                              size=(40, -1))
     h = self.texty.GetSize().height
     self.spiny = wx.SpinButton(self, -1, pos=(42, 3), size=(h * 2, h))
     self.spiny.SetRange(1970, 3000)
     self.spiny.SetValue(start_year)
     self.Bind(wx.EVT_SPIN, self.OnSpiny, self.spiny)
     self.textm = wx.TextCtrl(self,
                              -1,
                              str(start_month),
                              pos=(109, 3),
                              size=(30, -1))
     h = self.textm.GetSize().height
     self.spinm = wx.SpinButton(self, -1, pos=(139, 3), size=(h * 2, h))
     self.spinm.SetRange(1, 12)
     self.spinm.SetValue(start_month)
     self.Bind(wx.EVT_SPIN, self.OnSpinm, self.spinm)
Пример #5
0
 def __init__(self):
     wx.Frame.__init__(self, None, wx.ID_ANY, 'grid_test', size=(500, 400))
     panel = wx.Panel(self, wx.ID_ANY)
     self.grid = wx.grid.Grid(panel)
     self.grid.CreateGrid(len(self.data), 3)
     self.grid.SetRowSize(0, 60)
     self.grid.SetColSize(1, 100)
     self.grid.SetColSize(2, 220)
     self.grid.SetColLabelValue(0, 'id')
     self.grid.SetColLabelValue(1, '文本')
     self.grid.SetColLabelValue(2, 'date')
     i, j = 0, 0
     self.row = 0
     self.col = 0
     for i in range(len(self.data)):
         # print(self.data[i])
         cell_1 = self.data[i].split(",", 1)
         # print(cell_1)
         cell_2 = cell_1[0].split("'")
         # print(cell_2[1])
         cell_3 = cell_1[1].split(",")
         cell_3 = cell_3[0].split(" ")
         cell_3 = cell_3[1].split(")")
         # print(cell_3[0])
         cell_4 = cell_1[1].split(",")
         cell_4 = cell_4[1].split(" ")
         cell_4 = cell_4[1].split(")")
         # print(cell_4[0])
         self.grid.SetCellValue(i, 0, cell_4[0])
         self.grid.SetCellValue(i, 1, cell_2[1])
         time = datetime.datetime.fromtimestamp(float(cell_3[0]))
         self.grid.SetCellValue(i, 2, datetime.datetime.strftime(time, "%Y-%m-%d %H:%M:%S"))
     self.grid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.show_pop_menu)
     self.grid.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.select_cell)
     # self.grid.Bind(wx.EVT_CLOSE, self.rel_update)
     sizer = wx.BoxSizer(wx.VERTICAL)
     hbox = wx.BoxSizer(wx.HORIZONTAL)
     spin = wx.StaticText(panel, -1, "按字母排序", pos=wx.DefaultPosition, size=wx.DefaultSize)
     font = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
     spin.SetFont(font)
     hbox.Add(spin)
     sc = wx.SpinButton(panel, -1, pos=wx.DefaultPosition, size=(30, 30))
     sc.Bind(wx.EVT_SPIN_UP, self.sort_by_up_spin)
     sc.Bind(wx.EVT_SPIN_DOWN, self.sort_by_down_spin)
     hbox.Add(sc)
     spin2 = wx.StaticText(panel, -1, "按时间排序", pos=wx.DefaultPosition, size=wx.DefaultSize)
     font = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
     spin2.SetFont(font)
     hbox.Add(spin2)
     sc2 = wx.SpinButton(panel, -1, pos=wx.DefaultPosition, size=(30, 30))
     sc2.Bind(wx.EVT_SPIN_UP, self.sort_by_up_spin_time)
     sc2.Bind(wx.EVT_SPIN_DOWN, self.sort_by_down_spin_time)
     hbox.Add(sc2)
     sizer.Add(self.grid, -1, wx.EXPAND, 2)
     sizer.Add(hbox)
     panel.SetSizer(sizer)
     self.select_id = self.grid.GetCellValue(self.row, 0)
Пример #6
0
	def __init__( self, parent ):
		wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.TAB_TRAVERSAL )
		
		bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
		
		sbSizer1 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Дата" ), wx.HORIZONTAL )
		
		self.dateEdit = wx.DatePickerCtrl( sbSizer1.GetStaticBox(), wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.DP_ALLOWNONE|wx.DP_DEFAULT )
		sbSizer1.Add( self.dateEdit, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 0 )
		
		
		bSizer7.Add( sbSizer1, 0, wx.ALIGN_CENTER_VERTICAL, 5 )
		
		sbSizer2 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Время" ), wx.HORIZONTAL )
		
		self.h_textCtrl = wx.TextCtrl( sbSizer2.GetStaticBox(), wx.ID_ANY, u"00", wx.DefaultPosition, wx.Size( 30,-1 ), 0 )
		sbSizer2.Add( self.h_textCtrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 0 )
		
		self.h_spinBtn = wx.SpinButton( sbSizer2.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer2.Add( self.h_spinBtn, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 0 )
		
		self.m_staticText1 = wx.StaticText( sbSizer2.GetStaticBox(), wx.ID_ANY, u":", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText1.Wrap( -1 )
		sbSizer2.Add( self.m_staticText1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
		
		self.m_textCtrl = wx.TextCtrl( sbSizer2.GetStaticBox(), wx.ID_ANY, u"00", wx.DefaultPosition, wx.Size( 30,-1 ), 0 )
		sbSizer2.Add( self.m_textCtrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 0 )
		
		self.m_spinBtn = wx.SpinButton( sbSizer2.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer2.Add( self.m_spinBtn, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 0 )
		
		self.m_staticText2 = wx.StaticText( sbSizer2.GetStaticBox(), wx.ID_ANY, u":", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText2.Wrap( -1 )
		sbSizer2.Add( self.m_staticText2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
		
		self.s_textCtrl = wx.TextCtrl( sbSizer2.GetStaticBox(), wx.ID_ANY, u"00", wx.DefaultPosition, wx.Size( 30,-1 ), 0 )
		sbSizer2.Add( self.s_textCtrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 0 )
		
		self.s_spinBtn = wx.SpinButton( sbSizer2.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), 0 )
		sbSizer2.Add( self.s_spinBtn, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 0 )
		
		
		bSizer7.Add( sbSizer2, 0, wx.ALIGN_CENTER_VERTICAL, 5 )
		
		
		self.SetSizer( bSizer7 )
		self.Layout()
		bSizer7.Fit( self )
		
		# Connect Events
		self.h_textCtrl.Bind( wx.EVT_TEXT, self.onHText )
		self.h_spinBtn.Bind( wx.EVT_SPIN, self.onHSpin )
		self.m_textCtrl.Bind( wx.EVT_TEXT, self.onMText )
		self.m_spinBtn.Bind( wx.EVT_SPIN, self.onMSpin )
		self.s_textCtrl.Bind( wx.EVT_TEXT, self.onSText )
		self.s_spinBtn.Bind( wx.EVT_SPIN, self.onSSpin )
Пример #7
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: PanPlantFrame1.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((613, 299))
        self.IndentDePlana1 = wx.SpinButton(self, wx.ID_ANY , style=wx.SP_ARROW_KEYS | wx.SP_HORIZONTAL)
        self.IndentSetPlan = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
        self.IndentDeSEdit = wx.ListBox(self, wx.ID_ANY, choices=["Editing", "Modifying","PromptEdit"])
        self.InEditPlan = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_BESTWRAP | wx.TE_MULTILINE | wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB)
        self.ViewModPlan = wx.ListBox(self, wx.ID_ANY, choices=["Viewing", "Selecting", "Calling"])
        self.LPind2 = wx.ListBox(self, wx.ID_ANY, choices=["Render", "Base", "Loader"])
        self.PlanExeEnter = wx.Button(self, wx.ID_ANY, "Exe")
        self.PlanExeSave = wx.Button(self, wx.ID_ANY, "Exes\n")
        self.ProcessDirect1 = wx.CheckBox(self, wx.ID_ANY, "To Globals", style=wx.ALIGN_RIGHT)
        self.ProcessDirect2 = wx.CheckBox(self, wx.ID_ANY, "Statements\n\n", style=wx.ALIGN_RIGHT)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_SPIN_DOWN, self.IndPlanSubtract, self.IndentDePlana1)
        self.Bind(wx.EVT_SPIN_UP, self.IndPlanAdd, self.IndentDePlana1)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.PlanSelect, self.IndentDeSEdit)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.PlanSelectMo, self.ViewModPlan)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.PanSelect, self.LPind2)
        self.Bind(wx.EVT_BUTTON, self.PlanExe, self.PlanExeEnter)
        self.Bind(wx.EVT_BUTTON, self.PlanExes, self.PlanExeSave)
        self.Bind(wx.EVT_CHECKBOX, self.DProcess1, self.ProcessDirect1)
        self.Bind(wx.EVT_CHECKBOX, self.DProcess2, self.ProcessDirect2)
Пример #8
0
    def __init__(self, parent, id=wx.NewId(), pos=wx.DefaultPosition, size=wx.DefaultSize, value=0.0,
                 min_value=None, max_value=None, steps=20, digits=6, name="SpinCtrl"):
        self.value = value
        self.min_value = min_value
        self.max_value = max_value
        self.steps = steps
        self.digits = digits
        self.value_change_func = None
        wx.Control.__init__(self, parent, id, pos, size,
                              wx.NO_BORDER | wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_CHILDREN | wx.TAB_TRAVERSAL,
                              wx.DefaultValidator, name)
        self.SetLabel(name)
        self.parent = parent
        self._text = wx.TextCtrl(self, wx.NewId(), pos=pos, size=wx.Size(size.GetWidth()-16, size.GetHeight()),
                                 style=wx.TE_RIGHT | wx.TE_PROCESS_ENTER| wx.TE_PROCESS_TAB, value="%.*g" % (self.digits, self.value),
                                 validator=NumberValidator(),
                                 name=name+"_TextCtrl")
        self._spin = wx.SpinButton(self, wx.NewId(), pos=pos, size=wx.Size(16, size.GetHeight()),
                                   style=wx.SP_ARROW_KEYS | wx.SP_VERTICAL, name=name+"_SpinButton")
        self._spin.SetRange(-32000, 32000)
        self._sizer = wx.BoxSizer(wx.HORIZONTAL)
        self._sizer.Add(self._text, 1)
        self._sizer.Add(self._spin)
        self.SetSizer(self._sizer)
        self._sizer.Layout()

        self._spin.Bind(wx.EVT_SPIN_UP,    self.eh_spin_up,
                        id=self._spin.GetId())
        self._spin.Bind(wx.EVT_SPIN_DOWN,  self.eh_spin_down,
                        id=self._spin.GetId())
        self._text.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter)
        self._text.Bind(wx.EVT_CHAR, self.OnChar)
Пример #9
0
    def __init__( self, parent, rang, accury, title):
        self.linux = platform.system() == 'Linux'
        wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size(-1,-1), style = wx.TAB_TRAVERSAL )
        sizer = wx.BoxSizer( wx.VERTICAL )
        self.slider = wx.Slider( self, wx.ID_ANY, 128, 0, 255, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL)
        sizer.Add( self.slider, 0, wx.TOP|wx.EXPAND, 5 )
        subsizer = wx.BoxSizer( wx.HORIZONTAL )
        self.lab_min = wx.StaticText( self, wx.ID_ANY, '0', wx.DefaultPosition, wx.DefaultSize, 0 )
        self.lab_min.Wrap( -1 )
        subsizer.Add( self.lab_min, 0, wx.BOTTOM|wx.LEFT|wx.ALIGN_CENTER, 5 )
        subsizer.AddStretchSpacer(prop=1)
        self.text = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(50,-1), 0 )
        subsizer.Add( self.text, 0, wx.BOTTOM|wx.ALIGN_CENTER, 5 )
        self.spin = wx.SpinButton( self, wx.ID_ANY, wx.DefaultPosition, wx.Size([20,-1][self.linux],-1),  [0, wx.SP_HORIZONTAL][self.linux])
        self.spin.SetRange(0, 255)
        self.spin.SetValue(128)
        subsizer.Add( self.spin, 0, wx.ALIGN_CENTER|wx.BOTTOM|wx.EXPAND, 5 )
        subsizer.AddStretchSpacer(prop=1)
        self.lab_max = wx.StaticText( self, wx.ID_ANY, '0', wx.DefaultPosition, wx.DefaultSize, 0 )
        self.lab_max.Wrap( -1 )
        subsizer.Add( self.lab_max, 0, wx.ALIGN_CENTER|wx.BOTTOM|wx.RIGHT, 5 )
        sizer.Add( subsizer, 0, wx.EXPAND, 0 )


        self.SetSizer( sizer )
        self.Layout()
        
        # Connect Events
        self.slider.Bind( wx.EVT_SCROLL, self.on_scroll )
        self.text.Bind( wx.EVT_KEY_UP, self.on_text )
        #if not self.linux:
        self.spin.Bind( wx.EVT_SPIN, self.on_spin )
        self.set_para(rang, accury)
Пример #10
0
    def OnScheduleSetup(self, evt):
        if True:
            self.scheduleDlg = wx.Dialog(self, -1, "Schedule Setup", 
                               style=wx.DEFAULT_DIALOG_STYLE|wx.SAVE, size=(400, 180))
            textDate = wx.StaticText(self.scheduleDlg, -1, "Date:", size=(30,-1))
            self.dpc = wx.GenericDatePickerCtrl(self.scheduleDlg, #size=(120,-1),
                                           style = wx.TAB_TRAVERSAL
                                           | wx.DP_DROPDOWN
                                           | wx.DP_SHOWCENTURY
                                           | wx.DP_ALLOWNONE )

            btn_selectSaved = wx.Button(self.scheduleDlg, -1, "Browse...")
            self.scheduleDlg.Bind(wx.EVT_BUTTON, self.OnSelectSaved, btn_selectSaved)
            st = wx.StaticText(self.scheduleDlg, -1, "Choose:")
            self.tc_saved = wx.TextCtrl(self.scheduleDlg, -1, "", size=(200, -1))
            
            textTime = wx.StaticText(self.scheduleDlg, -1, "Time:", size=(30,-1))
            spin2 = wx.SpinButton(self.scheduleDlg, -1, wx.DefaultPosition, (-1, 25), wx.SP_VERTICAL)
            self.time24 = masked.TimeCtrl(
                            self.scheduleDlg, -1, name="24 hour control", fmt24hr=True,
                            spinButton = spin2
                            )
            sizer = rcs.RowColSizer()

            box0 = wx.BoxSizer(wx.HORIZONTAL)
            box0.Add(st, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
            box0.Add(self.tc_saved, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
            box0.Add(btn_selectSaved, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
            sizer.Add(box0, row=1, col=1, colspan=8)
            
            box1 = wx.BoxSizer(wx.HORIZONTAL)
            box1.Add(textDate, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
            box1.Add(self.dpc, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
            sizer.Add(box1, row=2, col=1, colspan=2)
            
            box2 = wx.BoxSizer(wx.HORIZONTAL)
            box2.Add(textTime, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
            box2.Add(self.time24, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
            box2.Add(spin2, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
            sizer.Add(box2, row=2, col=4, colspan=2)
            
            btnsizer = wx.StdDialogButtonSizer()
            
            if wx.Platform != "__WXMSW__":
                btn = wx.ContextHelpButton(self)
                btnsizer.AddButton(btn)
            
            btnSave = wx.Button(self.scheduleDlg, wx.ID_SAVE)
            btnSave.SetDefault()
            self.scheduleDlg.Bind(wx.EVT_BUTTON, self.OnScheduleSave, btnSave)
            btnsizer.AddButton(btnSave)
            
            btnCancel = wx.Button(self.scheduleDlg, wx.ID_CANCEL)
            btnsizer.AddButton(btnCancel)
            btnsizer.Realize()
            sizer.Add(btnsizer, row=4, col=1, colspan=5)
            self.scheduleDlg.SetSizer(sizer)
            
            scheduleDlgCode = self.scheduleDlg.ShowModal()
            self.scheduleDlg.Destroy()
Пример #11
0
    def __init__(self,
                 parent,
                 ID,
                 title,
                 size=wx.DefaultSize,
                 pos=wx.DefaultPosition,
                 style=wx.DEFAULT_DIALOG_STYLE):

        pre = wx.PreDialog()
        pre.Create(parent, ID, title, pos, size, style)

        self.PostCreate(pre)

        vbox = wx.BoxSizer(wx.VERTICAL)

        box = wx.BoxSizer(wx.HORIZONTAL)
        self.text = wx.TextCtrl(self, -1, "1")
        box.Add(self.text)
        self.spin = wx.SpinButton(self, -1)
        box.Add(self.spin)

        vbox.Add(box, wx.EXPAND)

        box = wx.BoxSizer(wx.HORIZONTAL)
        ok = wx.Button(self, wx.ID_OK, "Ok")
        box.Add(ok)
        cancel = wx.Button(self, wx.ID_CANCEL, "Cancel")
        box.Add(cancel)

        vbox.Add(box)

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

        self.Bind(wx.EVT_SPIN, self.on_spin, self.spin)
Пример #12
0
 def __init__(self, parent, x, y, label, fmin, fmax, freq, command):
   self.pos = (x, y)
   self.label = label
   self.fmin = fmin
   self.fmax = fmax
   self.command = command
   self.font = wx.Font(16, wx.FONTFAMILY_SWISS, wx.NORMAL, wx.FONTWEIGHT_NORMAL, False, conf.quisk_typeface)
   t = wx.StaticText(parent, -1, label, pos=(x, y))
   t.SetFont(self.font)
   freq_w, freq_h = t.GetTextExtent(" 662 000 000")
   tw, th = t.GetSize().Get()
   x += tw + 20
   wx.TextCtrl.__init__(self, parent, size=(freq_w, freq_h), pos=(x, y),
     style=wx.TE_RIGHT|wx.TE_PROCESS_ENTER)
   self.SetFont(self.font)
   self.Bind(wx.EVT_TEXT, self.OnText)
   self.Bind(wx.EVT_TEXT_ENTER, self.OnEnter)
   w, h = self.GetSize().Get()
   x += w + 1
   self.butn = b = wx.SpinButton(parent, size=(freq_h, freq_h), pos=(x, y))
   w, h = b.GetSize().Get()
   self.end_pos = (x + w, y + h)
   b.Bind(wx.EVT_SPIN, self.OnSpin)	# The spin button frequencies are in kHz
   b.SetMin(fmin // 1000)
   b.SetMax(fmax // 1000)
   self.SetValue(freq)
Пример #13
0
    def __init__(self, parent, rang, accury):
        self.linux = platform.system() == 'Linux'
        wx.Panel.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          pos=wx.DefaultPosition,
                          size=wx.Size(-1, -1),
                          style=wx.TAB_TRAVERSAL)
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        if self.linux:
            self.slider = wx.ScrollBar(self, wx.ID_ANY, wx.DefaultPosition,
                                       wx.Size(-1, 25), wx.SB_HORIZONTAL)
        else:
            self.slider = wx.Slider(self, wx.ID_ANY, 128, 0, 255,
                                    wx.DefaultPosition, wx.DefaultSize,
                                    wx.SL_HORIZONTAL | wx.SL_SELRANGE)
        sizer.Add(self.slider, 1, wx.ALIGN_CENTER | wx.ALL, 0)
        self.text = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                wx.DefaultPosition, wx.Size(40, -1), 0)
        sizer.Add(self.text, 0, wx.ALIGN_CENTER | wx.ALL, 0)
        if not self.linux:
            self.spin = wx.SpinButton(self, wx.ID_ANY, wx.DefaultPosition,
                                      wx.Size(25, 25), 0)
            sizer.Add(self.spin, 0, wx.ALIGN_CENTER | wx.ALL, 0)
        self.SetSizer(sizer)
        self.Layout()

        # Connect Events
        self.slider.Bind(wx.EVT_SCROLL, self.on_scroll)
        self.text.Bind(wx.EVT_KEY_UP, self.on_text)
        if not self.linux:
            self.spin.Bind(wx.EVT_SPIN_DOWN, self.on_down)
            self.spin.Bind(wx.EVT_SPIN_UP, self.on_up)
        self.set_para(rang, accury)
Пример #14
0
    def __set_properties(self):
        h = self.ctl_time.GetSize().height
        self.spn_time = wx.SpinButton(self, wx.ID_ANY, wx.DefaultPosition,
                                      (-1, h), wx.SP_VERTICAL)
        self.ctl_time.BindSpinButton(self.spn_time)

        self.setTime()
Пример #15
0
	def add(self,widget,field=None):
		widget_type = type(widget)
	        if(widget_type==TextArea or isinstance(widget,TextArea)):
			widget.controller = wx.TextCtrl(self.panel, -1, widget.text,  widget.position, widget.size, style=wx.TE_MULTILINE)
		elif(widget_type==Password or isinstance(widget,Password)):      
			widget.controller = wx.TextCtrl(self.panel, -1, widget.text,  widget.position, widget.size, style=wx.TE_PASSWORD)
		elif(widget_type==TextLine or isinstance(widget,TextLine)):      
			widget.controller = wx.TextCtrl(self.panel, -1, widget.text,  widget.position, widget.size, style=0) 
		elif(widget_type==Slider or isinstance(widget,Slider)):
			widget.controller = wx.Slider(self.panel, -1, value = -1,minValue=widget.start,maxValue=widget.end,pos=widget.pos,size=widget.size)	
			#self,start,end,X,Y,width,height
		elif(widget_type==SpinBox or isinstance(widget,SpinBox)):
			widget.controller = wx.SpinButton(self.panel, -1,  widget.pos, widget.size)			
		elif(widget_type==Button or isinstance(widget,Button)):
        		widget.controller = wx.Button(self.panel, -1, widget.title,  widget.position, widget.size)
          		if(widget.callBackMethod is not None):
                		widget.controller.Bind(wx.EVT_BUTTON,widget.callBackMethod,id = widget.controller.GetId())
        	elif(widget_type==CheckBox or isinstance(widget,CheckBox)):
          		widget.controller = wx.CheckBox(self.panel, -1, widget.title,  widget.position)
        	elif(widget_type==RadioGroup or isinstance(widget,RadioGroup)):
            		widget.controller = []
          		radio_controller = wx.RadioButton(self.panel, -1, widget.labels[0], widget.positions[0],widget.size,style=wx.RB_GROUP)
            		widget.controller.append(radio_controller)
            		for i in range(1,len(widget.labels)):
                		radio_controller = wx.RadioButton(self.panel, -1, widget.labels[i], widget.positions[i],widget.size)
                		widget.controller.append(radio_controller)
                        if(widget.selected_index != None):
                		widget.controller[widget.selected_index].SetValue(True)
		elif(widget_type==ValueList or isinstance(widget,ValueList)):
         		widget.controller = wx.ComboBox(self.panel, -1,widget.value,widget.position,widget.size,widget.choices,style=wx.CB_READONLY)
		elif(widget_type==Label or isinstance(widget,Label)):
			widget.controller = wx.StaticText(self.panel,-1,widget.name,widget.position,widget.size)
Пример #16
0
    def __init__(self, parent, title, rows):
        Dialog.__init__(self, parent)
        if hasattr(sys, "_MEIPASS"):
            ico_str = os.path.join(sys._MEIPASS, 'res/Clock.ico')
        else:
            ico_str = 'res/Clock.ico'

        ico = Path(ico_str)
        if ico.is_file():
            ico = wx.Icon(ico_str, wx.BITMAP_TYPE_ICO)
            self.SetIcon(ico)
        else:
            print("Ico File Not Found")

        self.rows = rows

        self.timeSpin = wx.SpinButton(self, -1, style=wx.SP_VERTICAL)
        self.triggerTime = TimeCtrl(self, -1, format='24HHMM')
        self.triggerTime.BindSpinButton(self.timeSpin)

        self.GetSizer().GetItem(0).GetSizer().Add(self.triggerTime, 1, wx.ALL,
                                                  5)
        self.GetSizer().GetItem(0).GetSizer().Add(self.timeSpin, 0, wx.EXPAND,
                                                  5)
        self.SetTitle(title)
Пример #17
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: SecondaryWindow.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.iconFile = "icons/icon.ico"
        self.icon = wx.Icon(self.iconFile, wx.BITMAP_TYPE_ICO)
        self.SetIcon(self.icon)
        self.panel_2 = wx.Panel(self, wx.ID_ANY)
        self.button_3 = wx.Button(self, wx.ID_ANY, ("24 Hour Plotting"))
        self.panel_3 = wx.Panel(self, wx.ID_ANY)
        self.button_4 = wx.Button(self, wx.ID_ANY, ("1 Hour Plotting"))
        self.panel_4 = wx.Panel(self, wx.ID_ANY)
        self.spin_button_1 = wx.SpinButton(self,
                                           wx.ID_ANY,
                                           style=wx.SP_VERTICAL)
        self.label_1 = wx.StaticText(self,
                                     wx.ID_ANY, (" Graph Shift"),
                                     style=wx.ALIGN_CENTRE)
        self.panel_5 = wx.Panel(self, wx.ID_ANY)

        self.Bind(wx.EVT_BUTTON, self.twentyFourHourPlot, id=self.button_3.Id)
        self.Bind(wx.EVT_BUTTON, self.oneHourPlot, id=self.button_4.Id)
        self.Bind(wx.EVT_SPIN_UP, self.graphMoveUp, id=self.spin_button_1.Id)
        self.Bind(wx.EVT_SPIN_DOWN,
                  self.graphMoveDown,
                  id=self.spin_button_1.Id)
        self.Bind(wx.EVT_CLOSE, self.doNothingIfExitButtonIsPressed)
        self.__set_properties()
        self.__do_layout()
Пример #18
0
    def __init__(self, parent, mode, data, *_args, **_kwargs):
        MyPopupctl.MyPopupControl.__init__(self, *_args, **_kwargs)
        self.win = wx.Window(self, -1, pos=(0, 0), style = 0)
        self.parent = parent
        self.mode = mode
        self.pop_obj = None
        self.selected_items = list()
        if mode == 1:
            self.pop_obj = CalendarCtrl(self.win, -1, pos=(0, 0))
            self.pop_obj.Bind(wx.adv.EVT_CALENDAR, self.on_calendar)
        elif mode == 2:
            if data is not None:
                self.pop_obj = wx.CheckListBox(self.win, -1, (0, 0), wx.DefaultSize, data)
                self.pop_obj.Bind(wx.EVT_CHECKLISTBOX, self.on_checklist_selected)
                self.parent.Bind(wx.EVT_LEFT_UP, self.on_checklist)
        elif mode == 3:
            if data is not None:
                spin = wx.SpinButton(self.win, -1, wx.DefaultPosition, (-1, 20), wx.SP_VERTICAL)
                self.pop_obj = masked.TimeCtrl(
                    self.win,
                    -1,
                    name="time_picker",
                    fmt24hr=True,
                    display_seconds=True,
                    spinButton = spin
                )
                self.pop_obj.SetValue('00:00:00')

        if self.pop_obj is not None:
            bz = self.pop_obj.GetBestSize()
            self.win.SetSize(bz)
            self.SetPopupContent(self.win)
Пример #19
0
 def __init__(self,
              parent,
              wxId=wx.ID_ANY,
              value=0,
              pos=wx.DefaultPosition,
              size=wx.DefaultSize,
              style=0,
              name='wx.SpinCtrl',
              **kwargs):  # pylint: disable=W0613
     super(SpinCtrl, self).__init__(parent,
                                    wxId,
                                    pos=pos,
                                    size=size,
                                    name=name)
     minValue = kwargs['min'] if 'min' in kwargs else -self.maxRange
     maxValue = kwargs['max'] if 'max' in kwargs else self.maxRange
     value = min(maxValue, max(int(value), minValue))
     self._textCtrl = wx.TextCtrl(self, value=str(value))
     self._spinButton = wx.SpinButton(
         self,
         size=(-1, self._textCtrl.GetSize()[1]),
         style=wx.SP_VERTICAL | wx.SP_ARROW_KEYS)
     self._spinButton.SetRange(minValue, maxValue)
     self._spinButton.SetValue(value)
     self._textCtrl.SetMinSize(
         (size[0] - self._spinButton.GetSize()[0], -1))
     sizer = wx.BoxSizer(wx.HORIZONTAL)
     sizer.AddMany([self._textCtrl, self._spinButton])
     self.SetSizerAndFit(sizer)
     self._textCtrl.Bind(wx.EVT_TEXT, self.onText)
     self._textCtrl.Bind(wx.EVT_KEY_DOWN, self.onKey)
     self._textCtrl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus)
     self._spinButton.Bind(wx.EVT_SPIN, self.onSpin)
Пример #20
0
    def __init__(self, parent, name='datetimectrl', use_now=False):
        self.name = name
        panel = self.panel = wx.Panel(parent)
        bgcol = wx.Colour(250, 250, 250)

        datestyle = wx.DP_DROPDOWN | wx.DP_SHOWCENTURY | wx.DP_ALLOWNONE

        self.datectrl = wx.DatePickerCtrl(panel,
                                          size=(120, -1),
                                          style=datestyle)
        self.timectrl = masked.TimeCtrl(panel,
                                        -1,
                                        name=name,
                                        limited=False,
                                        fmt24hr=True,
                                        oob_color=bgcol)
        timerheight = self.timectrl.GetSize().height
        spinner = wx.SpinButton(panel, -1, wx.DefaultPosition,
                                (-1, timerheight), wx.SP_VERTICAL)
        self.timectrl.BindSpinButton(spinner)
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.datectrl, 0, wx.ALIGN_CENTER)
        sizer.Add(self.timectrl, 0, wx.ALIGN_CENTER)
        sizer.Add(spinner, 0, wx.ALIGN_LEFT)
        panel.SetSizer(sizer)
        sizer.Fit(panel)
        if use_now:
            self.timectrl.SetValue(wx.DateTime_Now())
Пример #21
0
    def CalcSizeFromTextSize(self, text=None):
        # To calculate best width to spinctrl
        if text is None:
            text = "{}".format(
                max(len(str(self._max_value)), len(str(self._min_value))) *
                "M")

        dc = wx.WindowDC(self)
        dc.SetFont(self.GetFont())
        width, height = dc.GetTextExtent(text)

        spin = wx.SpinCtrl(self, -1)
        spin_width, spin_height = spin.GetBestSize()
        spin.Destroy()

        if self._spinbtn:
            spin = wx.SpinCtrl(self, -1)
            spin_width, spin_height = spin.GetBestSize()
            spin.Destroy()

            spinb = wx.SpinButton(self, -1)
            spinb_width, spinb_height = spinb.GetBestSize()
            spinb.Destroy()

            width += spinb_width
            if wx.Platform == "__WXMAC":
                height = max(height, spin_height, spinb_height)
            else:
                height = spin_height
        else:
            height = -1

        self.SetMinSize((width, height))
        self.Layout()
Пример #22
0
    def __init__(self, parent, IDactivite=None, dictSelections={}, activeIncompatibilites=True):
        wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX)
        self.parent = parent
        self.IDactivite = IDactivite
        
        intro = _(u"Cliquez sur les cases blanches pour sélectionner des combinaisons d'unités. <U>Important :</U> Cliquez avec le bouton droit de la souris sur les cases Dates pour utiliser le Copier-Coller ou utilisez la fonction de traitement par lot pour effectuer des saisies ou modifications encore plus rapides.")
        titre = _(u"Sélection de combinaisons d'unités")
        self.SetTitle(titre)
        self.ctrl_bandeau = CTRL_Bandeau.Bandeau(self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Calendrier.png")
        
        # Selection Mois
        self.staticbox_mois_staticbox = wx.StaticBox(self, -1, _(u"Sélection du mois"))
        self.label_mois = wx.StaticText(self, -1, _(u"Mois :"))
        self.ctrl_mois = wx.Choice(self, -1, choices=[_(u"Janvier"), _(u"Février"), _(u"Mars"), _(u"Avril"), _(u"Mai"), _(u"Juin"), _(u"Juillet"), _(u"Août"), _(u"Septembre"), _(u"Octobre"), _(u"Novembre"), _(u"Décembre")])
        self.spin_mois = wx.SpinButton(self, -1, size=(18, 20),  style=wx.SP_VERTICAL)
        self.spin_mois.SetRange(-1, 1)
        self.label_annee = wx.StaticText(self, -1, _(u"Année :"))
        self.ctrl_annee = wx.SpinCtrl(self, -1, "", min=1977, max=2999)
        dateDuJour = datetime.date.today()
        self.ctrl_annee.SetValue(dateDuJour.year)
        self.ctrl_mois.SetSelection(dateDuJour.month-1)
        
        # Légende
        self.staticbox_legende_staticbox = wx.StaticBox(self, -1, _(u"Légende"))
        self.listeLegende = [
            { "label" : _(u"Sélections"), "couleur" : COULEUR_SELECTION, "ctrl_label" : None, "ctrl_img" : None },
            { "label" : _(u"Ouvert"), "couleur" : COULEUR_OUVERTURE, "ctrl_label" : None, "ctrl_img" : None },
            { "label" : _(u"Fermé"), "couleur" : COULEUR_FERMETURE, "ctrl_label" : None, "ctrl_img" : None },
            { "label" : _(u"Vacances"), "couleur" : COULEUR_VACANCES, "ctrl_label" : None, "ctrl_img" : None },
            { "label" : _(u"Férié"), "couleur" : COULEUR_FERIE, "ctrl_label" : None, "ctrl_img" : None },
            ]
        index = 0
        for dictTemp in self.listeLegende :
            img = wx.StaticBitmap(self, -1, CreationImage(12, 12, dictTemp["couleur"]))
            label = wx.StaticText(self, -1, dictTemp["label"]) 
            self.listeLegende[index]["ctrl_img"] = img
            self.listeLegende[index]["ctrl_label"] = label
            index += 1
        
        # Calendrier
        self.staticbox_calendrier_staticbox = wx.StaticBox(self, -1, _(u"Calendrier"))
        self.ctrl_calendrier = Calendrier(self, self.IDactivite, dictSelections, activeIncompatibilites)
                
        self.bouton_aide = CTRL_Bouton_image.CTRL(self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png")
        self.bouton_saisie_lot = CTRL_Bouton_image.CTRL(self, texte=_(u"Saisie et suppression par lot"), cheminImage="Images/32x32/Magique.png")
        self.bouton_ok = CTRL_Bouton_image.CTRL(self, texte=_(u"Ok"), cheminImage="Images/32x32/Valider.png")
        self.bouton_annuler = CTRL_Bouton_image.CTRL(self, id=wx.ID_CANCEL, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png")

        self.__set_properties()
        self.__do_layout()
        
        self.Bind(wx.EVT_SPIN, self.OnSpinMois, self.spin_mois)
        self.Bind(wx.EVT_CHOICE, self.OnMois, self.ctrl_mois)
        self.Bind(wx.EVT_SPINCTRL, self.OnAnnee, self.ctrl_annee)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonSaisieLot, self.bouton_saisie_lot)
        
        self.MAJCalendrier()
Пример #23
0
    def dataLoaded(self):
        self.picks = defaultdict()
        box1label = wx.StaticText(self, label="Classes:", pos=(5, 35), style=0)
        self.boxl = wx.ListBox(self, -1, (5, 50), (100, 300), self.classes,
                               wx.LB_SINGLE)
        self.renameButton = wx.Button(self,
                                      label='Change to different class',
                                      pos=(315, 50),
                                      size=(200, 25))
        self.chooseButton = wx.Button(self,
                                      label='Choose',
                                      pos=(315, 80),
                                      size=(200, 25))
        self.export = wx.Button(self,
                                label='Export output',
                                pos=(315, 540),
                                size=(200, 25))
        self.Bind(wx.EVT_BUTTON, self.picked, self.chooseButton)
        self.Bind(wx.EVT_BUTTON, self.OnSaveAs, self.export)
        self.Bind(wx.EVT_BUTTON, self.renameClass, self.renameButton)

        picksLabel = wx.StaticText(self,
                                   label="Picks:",
                                   pos=(115, 85),
                                   style=0)
        self.classCountArea = wx.TextCtrl(self,
                                          value="1",
                                          pos=(155, 80),
                                          size=(100, 25))
        self.classCount = wx.SpinButton(self, pos=(255, 80), size=(25, 25))
        self.classCount.SetRange(1, 10000)
        self.classCount.SetValue(1)
        self.Bind(wx.EVT_SPIN, self.OnSpin, self.classCount)

        self.renameTextName = wx.TextCtrl(self, pos=(115, 50), size=(195, 25))
        self.renameTextName.write("Rename to...")

        self.className = wx.TextCtrl(self, pos=(115, 110), size=(400, 25))
        self.className.SetEditable(False)
        self.className.write("You must to choose a class")

        self.Bind(wx.EVT_LISTBOX, self.selectClass, self.boxl)
        box1labe2 = wx.StaticText(self,
                                  label="Documents:",
                                  pos=(115, 140),
                                  style=0)
        self.box1labe3 = wx.StaticText(self,
                                       label="Unselected",
                                       pos=(185, 140),
                                       style=0)
        self.box2 = wx.ListBox(self, -1, (115, 160), (400, 190), [],
                               wx.LB_SINGLE)
        #self.box3 = wx.ListCtrl(self, -1, (5, 355), (510, 100), [] , wx.LB_SINGLE)
        self.box3 = wx.ListCtrl(self, size=(510, 180), style=wx.LC_REPORT)
        self.box3.SetPosition((5, 355))
        self.box3.InsertColumn(0, 'Class')
        self.box3.InsertColumn(1, 'Random picks', width=125)
        self.index = 0
Пример #24
0
    def __init__(self,
                 parent,
                 pos=(0, 0),
                 minimums=(1, 1, 0),
                 maximums=(999, 4, 480),
                 value=JetDefs.MBT_DEFAULT,
                 ctlName=''):
        wx.Frame.__init__(self, parent, -1)

        self.ChangeCallbackFct = None
        self.ctlName = ctlName
        self.mx = maximums
        self.mn = minimums
        self.maxTicks = 0
        self.iCtrl = 0
        p1 = pos[0]
        top = pos[1] + MacOffset()
        w1 = 30
        self.time = (
            wx.TextCtrl(parent,
                        -1,
                        str(value[0]),
                        pos=(p1, top),
                        size=(w1, -1),
                        style=wx.TE_NOHIDESEL),
            wx.TextCtrl(parent,
                        -1,
                        str(value[1]),
                        pos=(p1 + (w1 + 3), top),
                        size=(w1, -1),
                        style=wx.TE_NOHIDESEL),
            wx.TextCtrl(parent,
                        -1,
                        str(value[2]),
                        pos=(p1 + (w1 + 3) * 2, top),
                        size=(w1, -1),
                        style=wx.TE_NOHIDESEL),
        )
        h = self.time[2].GetSize().height
        w = self.time[2].GetSize().width + self.time[2].GetPosition().x + 8

        self.spin = wx.SpinButton(parent, -1, (w, top), (h * 2 / 3, h),
                                  wx.SP_VERTICAL)
        self.spin.SetValue(1)
        self.spin.SetRange(-999, 999)

        self.spin.Bind(wx.EVT_SPIN_UP, self.OnSpinUp, self.spin)
        self.spin.Bind(wx.EVT_SPIN_DOWN, self.OnSpinDown, self.spin)

        self.time[0].Bind(wx.EVT_SET_FOCUS, self.OnFocusMeasure, self.time[0])
        self.time[1].Bind(wx.EVT_SET_FOCUS, self.OnFocusBeat, self.time[1])
        self.time[2].Bind(wx.EVT_SET_FOCUS, self.OnFocusTick, self.time[2])

        self.time[0].Bind(wx.EVT_KILL_FOCUS, self.OnChangeVal, self.time[0])
        self.time[1].Bind(wx.EVT_KILL_FOCUS, self.OnChangeVal, self.time[1])
        self.time[2].Bind(wx.EVT_KILL_FOCUS, self.OnChangeVal, self.time[2])

        self.SetValue(value)
Пример #25
0
 def test_spinctrlPropertiesInAction(self):
     sb = wx.SpinButton(self.frame)
     sb.Max = 75
     sb.Min = 25
     sb.Value = 50
     self.assertTrue((sb.GetMin(), sb.GetMax()) == (25, 75))
     self.assertTrue(sb.GetRange() == (25, 75))
     self.assertTrue(sb.Range == (25, 75))
     self.assertTrue(sb.GetValue() == 50)
Пример #26
0
    def __init__(self, parent, widget):
        CorbomiteGuiWidget.__init__(self, parent, widget)
        self.preferedPrefix, foo = \
            common.corbomiteValue.calculatePrefix(self.widget.value.getUnit())
        self.label = wx.StaticText(self, label=self.widget.name)
        self.valueText = wx.TextCtrl(self, style=wx.TE_PROCESS_ENTER)
        self.Bind(wx.EVT_TEXT_ENTER, self.onEnter, self.valueText)
        font = wx.Font(4, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
        self.spinX3 = wx.SpinButton(self, style=wx.SP_VERTICAL)
        self.spinX3.SetValue(1)
        self.textX3 = wx.StaticText(self, -1, '1\n0\n0')
        self.textX3.SetFont(font)
        self.spinX2 = wx.SpinButton(self, style=wx.SP_VERTICAL)
        self.spinX2.SetValue(1)
        self.textX2 = wx.StaticText(self, -1, '1\n0')
        self.textX2.SetFont(font)
        self.spinX1 = wx.SpinButton(self, style=wx.SP_VERTICAL)
        self.spinX1.SetValue(1)
        self.textX1 = wx.StaticText(self, -1, '1')
        self.textX1.SetFont(font)
        self.spinUnit = wx.SpinButton(self, style=wx.SP_VERTICAL)
        self.spinUnit.SetValue(1)
        self.textUnit = wx.StaticText(
            self, -1, common.corbomiteValue.prefixLetter(self.preferedPrefix))
        self.Bind(wx.EVT_SPIN, self.onPrefixSpin, self.spinUnit)
        self.Bind(wx.EVT_SPIN, self.onSpinX3, self.spinX3)
        self.Bind(wx.EVT_SPIN, self.onSpinX2, self.spinX2)
        self.Bind(wx.EVT_SPIN, self.onSpinX1, self.spinX1)
        self.slider = wx.Slider(self, wx.ID_ANY, 0, 0, 1000000)
        self.slider.Bind(wx.EVT_SCROLL, self.onSlide)
        self.updateValue(self.widget.value.minUnit)

        self.sizer.Add(self.label, 4 * 3)
        self.sizer.Add(self.valueText, 8 * 3)
        self.sizer.Add(self.textX3, 1, wx.FIXED_MINSIZE,
                       wx.ALIGN_CENTER_VERTICAL)
        self.sizer.Add(self.spinX3, 1 * 3)
        self.sizer.Add(self.textX2, 1, wx.FIXED_MINSIZE)
        self.sizer.Add(self.spinX2, 1 * 3)
        self.sizer.Add(self.textX1, 1, wx.FIXED_MINSIZE)
        self.sizer.Add(self.spinX1, 1 * 3)
        self.sizer.Add(self.textUnit, 2, wx.FIXED_MINSIZE)
        self.sizer.Add(self.spinUnit, 1 * 3)
        self.sizer.Add(self.slider, 12 * 3)
Пример #27
0
    def __init__(self, **kwargs):

        #构造基类方法
        super(myFrame, self).__init__(**kwargs)

        panel = wx.Panel(self)

        wx.SpinButton(panel)

        wx.SpinCtrl(panel, pos=(30, 0))
Пример #28
0
 def __init__(self):
     wx.Frame.__init__(self, None, -1, "spinner example", size=(200, 100))
     panel = wx.Panel(self, -1)
     sc = wx.SpinCtrl(panel,
                      -1,
                      "", (30, 20), (80, -1),
                      max=100,
                      min=1,
                      initial=5)
     s = wx.SpinButton(panel, -1)
Пример #29
0
 def _CreateGui(self, size):
     sizer = wx.BoxSizer(wx.HORIZONTAL)
     self.text = wx.TextCtrl(self, size=size)
     self.spin = wx.SpinButton(self, style=wx.SP_VERTICAL, size=(-1, self.text.GetSize()[1] + 5))
     sizer.Add(self.text, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL)
     sizer.Add(self.spin, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL)
     self.Bind(wx.EVT_CHAR, self._OnKeyPress, self.text)
     self.Bind(wx.EVT_SPIN_UP, self._OnSpinUp, self.spin)
     self.Bind(wx.EVT_SPIN_DOWN, self._OnSpinDown, self.spin)
     self.SetSizerAndFit(sizer)
Пример #30
0
    def SetupHeadSection(self):
        # Sizer with combo boxes to define new action
        comboSizer = wx.BoxSizer()
        cmdChoices = []
        for c in CMD:
            cmdChoices.append(tr(c))
        self.cmdCombo = wx.ComboBox(self, -1, choices=cmdChoices, size=(134,26))
        self.cmdCombo.SetName('cmd')
        typeChoices = []
        for t in TYPE:
            typeChoices.append(tr(t))
        self.typeCombo = wx.ComboBox(self, -1, choices=typeChoices, size=(174,26))
        self.typeCombo.SetName('type')
        self.times = []
        for i in range(256):
            self.times.append(str(i))
        self.timeCombo = wx.ComboBox(self, -1, choices=self.times, size=(77,26))

        self.timeSpin = wx.SpinButton(self,-1,style=wx.SP_VERTICAL)
        self.triggerTime = masked.TimeCtrl(self,-1,format='24HHMM')
        self.triggerTime.BindSpinButton(self.timeSpin)

        self.addBtn = wx.Button(self,-1,label="+", size=(25,25))

        self.Bind(wx.EVT_COMBOBOX, self.ComboSelection, self.cmdCombo)
        self.Bind(wx.EVT_COMBOBOX, self.ComboSelection, self.typeCombo)
        self.Bind(wx.EVT_COMBOBOX, self.ComboSelection, self.timeCombo)
        self.Bind(wx.EVT_BUTTON, self.AddAction, self.addBtn)

        comboSizer.Add(self.cmdCombo, flag = wx.LEFT, border = 10)
        comboSizer.Add(self.typeCombo)
        comboSizer.Add(self.timeCombo)
        comboSizer.Add(self.triggerTime)
        comboSizer.Add(self.timeSpin,flag=wx.RIGHT,border=3)
        comboSizer.Add(self.addBtn, flag = wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, border = 10)
        self.addBtn.Disable()
        self.ResetCombos()

        # Sizer with labels for the combo boxes
        labelSizer = wx.BoxSizer()

        cmdLabel = wx.StaticText(self,-1,label="Command:",size=(self.cmdCombo.GetSize()[0],17))
        triggerLabel = wx.StaticText(self,-1,label="Trigger:",size=(self.typeCombo.GetSize()[0],17))
        self.timeLabel = wx.StaticText(self,-1,label="Delay:",size=(self.timeCombo.GetSize()[0],17))
        specTimeLabel = wx.StaticText(self,-1,label="Time:")

        labelSizer.Add(cmdLabel, flag = wx.LEFT| wx.TOP, border = 6)
        labelSizer.Add(triggerLabel, flag = wx.TOP, border = 6)
        labelSizer.Add(self.timeLabel, flag = wx.TOP, border = 6)
        labelSizer.Add(specTimeLabel, flag = wx.TOP, border = 6)

        self.headSizer.Add(labelSizer)
        self.headSizer.Add(comboSizer)