Exemple #1
0
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self,
                           parent,
                           id,
                           title,
                           size=(APP_SIZE_X, APP_SIZE_Y))

        self.panel = wx.Panel(self)

        wx.Button(self, 1, u'确定', (50, 130))
        start = wx.StaticText(self, -1, u'开始时间:')
        end = wx.StaticText(self, -1, u'结束时间:')

        sizer = wx.GridBagSizer(4, 4)
        """
        dpc1 = wx.GenericDatePickerCtrl(
            self, size=(120, -1),
            style = wx.TAB_TRAVERSAL
            | wx.DP_DROPDOWN
            | wx.DP_SHOWCENTURY
            | wx.DP_ALLOWNONE
        )
        """
        dpc1 = wx.GenericDatePickerCtrl(self, size=(120, -1))
        dpc2 = wx.GenericDatePickerCtrl(self,
                                        size=(120, -1),
                                        style=wx.TAB_TRAVERSAL
                                        | wx.DP_DROPDOWN
                                        | wx.DP_SHOWCENTURY
                                        | wx.DP_ALLOWNONE)

        self.Bind(wx.EVT_BUTTON, self.OnClose, id=1)
        #EVT_LEFT_DOWN
        self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged, dpc1)
        self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged2, dpc2)

        sizer.Add(start,
                  pos=(1, 0),
                  flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                  border=5)
        sizer.Add(dpc1, pos=(1, 1), flag=wx.LEFT, border=0)
        sizer.Add(end, pos=(2, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=5)
        sizer.Add(dpc2, pos=(2, 1), flag=wx.LEFT, border=0)
        sizer.AddGrowableRow(2)
        sizer.AddGrowableCol(1)

        self.SetSizer(sizer)
        self.Centre()
        self.ShowModal()
Exemple #2
0
    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)

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

        dpc = wx.DatePickerCtrl(self,
                                size=(120, -1),
                                style=wx.DP_DROPDOWN
                                | wx.DP_SHOWCENTURY
                                | wx.DP_ALLOWNONE)
        self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged, dpc)
        sizer.Add(dpc, 0, wx.ALL, 50)

        # In some cases the widget used above will be a native date
        # picker, so show the generic one too.
        dpc = wx.GenericDatePickerCtrl(self,
                                       size=(120, -1),
                                       style=wx.TAB_TRAVERSAL
                                       | wx.DP_DROPDOWN
                                       | wx.DP_SHOWCENTURY
                                       | wx.DP_ALLOWNONE)
        self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged, dpc)
        sizer.Add(dpc, 0, wx.LEFT, 50)
Exemple #3
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()
 def GetDatePicker(self, panel):
     dpc = wx.GenericDatePickerCtrl(panel,
                                    size=(120, -1),
                                    style=wx.TAB_TRAVERSAL
                                    | wx.DP_DROPDOWN
                                    | wx.DP_SHOWCENTURY
                                    | wx.DP_ALLOWNONE)
     return dpc
Exemple #5
0
    def __init__(self, parent, readydata):
        if readydata['mode'] == 'insert':
            title = _('Add payout item')
        else:
            title = _('Edit payout item')
        MySizedDialog.__init__(self,
                               None,
                               -1,
                               title,
                               style=wx.DEFAULT_DIALOG_STYLE
                               | wx.RESIZE_BORDER)
        self.parent = parent
        self.data = readydata

        panel = self.GetContentsPane()
        panel.SetSizerType("form")

        wx.StaticText(panel, -1, _('Date:'))
        #self.date = wx.DatePickerCtrl(panel, size=(120, -1), style=wx.DP_DROPDOWN|
        tm = wx.DateTime()
        tm.Set(readydata['day'], readydata['month'] - 1, readydata['year'])
        self.date = wx.GenericDatePickerCtrl(
            panel,
            dt=tm,
            size=(120, -1),
            style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY | wx.DP_ALLOWNONE)

        wx.StaticText(panel, -1, _('Category:'))
        items = readydata['cates']
        self.cate = wx.ComboBox(panel, -1, readydata['cate'], (90, 50),
                                (160, -1), items,
                                wx.CB_DROPDOWN | wx.CB_READONLY)

        wx.StaticText(panel, -1, _('Payment:'))
        items = [_('Cash'), _('Credit Card')]
        self.pay = wx.ComboBox(panel, -1, readydata['pay'], (90, 50),
                               (160, -1), items,
                               wx.CB_DROPDOWN | wx.CB_READONLY)

        wx.StaticText(panel, -1, _('Money:'))
        self.num = wx.TextCtrl(panel,
                               -1,
                               str(readydata['num']),
                               size=(125, -1))

        wx.StaticText(panel, -1, _('Explain:'))
        self.explain = wx.TextCtrl(panel,
                                   -1,
                                   readydata['explain'],
                                   size=(220, 100),
                                   style=wx.TE_MULTILINE)

        wx.StaticText(panel, -1, '')
        self.reuse = wx.CheckBox(panel, -1, _("Not close dialog, continue."))

        self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
        self.SetMinSize(wx.Size(300, 250))
        self.Fit()
Exemple #6
0
    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)

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

        dpc = wx.DatePickerCtrl(self,
                                size=(120, -1),
                                style=wx.DP_DROPDOWN
                                | wx.DP_SHOWCENTURY
                                | wx.DP_ALLOWNONE)
        self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged, dpc)
        sizer.Add(dpc, 0, wx.ALL, 50)

        if 'wxMSW' in wx.PlatformInfo:
            dpc = wx.GenericDatePickerCtrl(self,
                                           size=(120, -1),
                                           style=wx.DP_DROPDOWN
                                           | wx.DP_SHOWCENTURY
                                           | wx.DP_ALLOWNONE)
            self.Bind(wx.EVT_DATE_CHANGED, self.OnDateChanged, dpc)
            sizer.Add(dpc, 0, wx.LEFT, 50)
    def ImpSetCriteria(self):
        global colList

        self.impcb = wx.CheckBox(self.panelB,
                                 -1,
                                 label="Age Limit",
                                 pos=(40, 130))
        self.min0 = masked.Ctrl(self.panelB,
                                pos=(240, 125),
                                size=(500, -1),
                                controlType=masked.controlTypes.NUMBER)
        self.min0.Enable(False)
        self.impdpc = wx.GenericDatePickerCtrl(
            self.panelB,
            size=(120, -1),
            pos=(420, 125),
            style=wx.TAB_TRAVERSAL | wx.DP_DROPDOWN | wx.DP_SHOWCENTURY
            | wx.DP_ALLOWNONE)
        self.impdpc.Enable(False)
        self.impcb.Disable()
        #self.Bind(wx.EVT_DATE_CHANGED, self.ImpOnDateChanged, self.impdpc)

        self.impcb1 = wx.CheckBox(self.panelB,
                                  -1,
                                  label="Aggregate (College)",
                                  pos=(40, 170))
        self.min1 = masked.Ctrl(self.panelB,
                                fractionWidth=2,
                                pos=(240, 165),
                                size=(50, -1),
                                controlType=masked.controlTypes.NUMBER)
        self.min1.Enable(False)
        #self.toLabel = wx.StaticText(self.panelB, -1, "To", pos=(380, 170)).SetFont(fontim)
        self.max1 = masked.Ctrl(self.panelB,
                                fractionWidth=2,
                                pos=(420, 165),
                                size=(50, -1),
                                controlType=masked.controlTypes.NUMBER)
        self.max1.Enable(False)
        self.impcb1.Disable()

        self.impcb2 = wx.CheckBox(self.panelB,
                                  -1,
                                  label="10th %",
                                  pos=(40, 210))
        self.min2 = masked.Ctrl(self.panelB,
                                fractionWidth=2,
                                pos=(240, 205),
                                controlType=masked.controlTypes.NUMBER)
        self.min2.Enable(False)
        #self.toLabel = wx.StaticText(self.panelB, -1, "To", pos=(380, 210)).SetFont(fontim)
        self.max2 = masked.Ctrl(self.panelB,
                                fractionWidth=2,
                                pos=(420, 205),
                                controlType=masked.controlTypes.NUMBER)
        self.max2.Enable(False)
        self.impcb2.Disable()

        self.impcb3 = wx.CheckBox(self.panelB,
                                  -1,
                                  label="12th %",
                                  pos=(40, 250))
        self.min3 = masked.Ctrl(self.panelB,
                                fractionWidth=2,
                                pos=(240, 245),
                                controlType=masked.controlTypes.NUMBER)
        self.min3.Enable(False)
        #self.toLabel = wx.StaticText(self.panelB, -1, "To", pos=(380, 250)).SetFont(fontim)
        self.max3 = masked.Ctrl(self.panelB,
                                fractionWidth=2,
                                pos=(420, 245),
                                controlType=masked.controlTypes.NUMBER)
        self.max3.Enable(False)
        self.impcb3.Disable()

        self.impcb4 = wx.CheckBox(self.panelB,
                                  -1,
                                  label="Top Rankers upto",
                                  pos=(40, 290))
        self.min4 = masked.Ctrl(self.panelB,
                                pos=(240, 285),
                                controlType=masked.controlTypes.NUMBER)
        self.min4.Enable(False)
        #self.toLabel = wx.StaticText(self.panelB, -1, "To", pos=(380, 290)).SetFont(fontim)
        #self.max4 = masked.Ctrl(self.panelB, fractionWidth=2, pos =(420, 285), controlType=masked.controlTypes.NUMBER )
        #self.max4.Enable(False)
        self.impcb4.Disable()

        self.Bind(wx.EVT_CHECKBOX, self.ImpOnDateCheckBox, self.impcb)
        self.Bind(wx.EVT_CHECKBOX, self.ImpOnCheckBox1, self.impcb1)
        self.Bind(wx.EVT_CHECKBOX, self.ImpOnCheckBox2, self.impcb2)
        self.Bind(wx.EVT_CHECKBOX, self.ImpOnCheckBox3, self.impcb3)
        self.Bind(wx.EVT_CHECKBOX, self.ImpOnCheckBox4, self.impcb4)

        if 'DOB' in colList:
            self.impcb.Enable()
        if 'TOTAL' in colList:
            self.impcb1.Enable()
            self.impcb4.Enable()
        if '10th' in colList:
            self.impcb2.Enable()
        if '12th' in colList:
            self.impcb3.Enable()
Exemple #8
0
    def __init__(self, *args, **kwds):
        size = (80, 80)
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_1 = wx.Panel(self, wx.ID_ANY)
        self.userBox = wx.ComboBox(self.panel_1,
                                   wx.ID_ANY,
                                   choices=["DISTINCT", "ALL"],
                                   style=wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
        self.majorListBox = wx.CheckListBox(
            self.panel_1,
            wx.ID_ANY,
            choices=[("c"), ("a"), ("b"), ("d")],
            style=wx.LB_ALWAYS_SB | wx.LB_MULTIPLE,
            size=size)
        self.allButton_1 = wx.Button(self.panel_1, wx.ID_ANY, ("ALL"))
        self.allButton_1.cat = "MAJOR"
        self.clearButton_1 = wx.Button(self.panel_1, wx.ID_ANY, ("CLEAR"))
        self.clearButton_1.cat = "MAJOR"
        self.allButton_2 = wx.Button(self.panel_1, wx.ID_ANY, ("ALL"))
        self.allButton_2.cat = "LEVEL"
        self.clearButton_2 = wx.Button(self.panel_1, wx.ID_ANY, ("CLEAR"))
        self.clearButton_2.cat = "LEVEL"
        self.allButton_3 = wx.Button(self.panel_1, wx.ID_ANY, ("ALL"))
        self.allButton_3.cat = "MACHINE"
        self.clearButton_3 = wx.Button(self.panel_1, wx.ID_ANY, ("CLEAR"))
        self.clearButton_3.cat = "MACHINE"
        self.levelListBox = wx.CheckListBox(
            self.panel_1,
            wx.ID_ANY,
            choices=[("c"), ("a"), ("b"), ("d")],
            style=wx.LB_ALWAYS_SB | wx.LB_MULTIPLE,
            size=size)
        self.machineListBox = wx.CheckListBox(self.panel_1,
                                              wx.ID_ANY,
                                              choices=[("c"), ("a"), ("b"),
                                                       ("d")],
                                              style=wx.LB_ALWAYS_SB
                                              | wx.LB_MULTIPLE,
                                              size=size)

        self.startCheckbox = wx.CheckBox(self.panel_1, wx.ID_ANY, "")
        self.startDate = wx.GenericDatePickerCtrl(self.panel_1,
                                                  size=(120, -1),
                                                  style=wx.DP_DROPDOWN)
        # self.startDateSelection = wx.DateTime.Today().FormatISODate().replace('-',"")
        self.startDateSelection = "%"
        self.startDate.SetRange(
            wx.DateTime.Today().__add__(wx.DateSpan(years=-5)),
            wx.DateTime.Today())
        self.endCheckbox = wx.CheckBox(self.panel_1, wx.ID_ANY, "")
        self.endDate = wx.GenericDatePickerCtrl(self.panel_1,
                                                size=(120, -1),
                                                style=wx.DP_DROPDOWN)
        self.endDateSelection = wx.DateTime.Today().__add__(
            wx.DateSpan(days=1)).FormatISODate().replace('-', "")
        self.endDate.SetValue(wx.DateTime.Today().__add__(wx.DateSpan(days=1)))

        self.hourBox = wx.CheckBox(self.panel_1, wx.ID_ANY, "HOURLY DATA")
        self.weeklyBox = wx.CheckBox(self.panel_1, wx.ID_ANY, "WEEKLY DATA")
        self.timedBox = wx.CheckBox(self.panel_1, wx.ID_ANY, "TIMED DATA")
        self.runButton = wx.Button(self.panel_1, wx.ID_ANY, (" RUN "))
        self.appendBox = wx.CheckBox(self.panel_1, wx.ID_ANY, "APPEND REPORTS")
        self.exportButton = wx.Button(self.panel_1, wx.ID_ANY, ("EXPORT"))
        self.exportButton.Disable()

        self.notebook = TestNB(self.panel_1, wx.ID_ANY)
        self.hourReports = False
        self.weeklyReports = False
        self.hourList = []
        for i in range(9, 21, 1):
            self.hourList.append(str(i))
        self.user = None
        self.singleUser = False
        self.umsDB = DatabaseHandler(self)
        self.majorList = []
        self.machineList = []
        self.levelList = []
        self.reportDict = {}

        self.__set_properties()
        self.__do_layout()
        self.__set_values()
Exemple #9
0
	def __init__(self, parent, title):
		wx.Frame.__init__(self, parent, title = title)

		self.startPick = wx.GenericDatePickerCtrl(self, size=(120,-1),style = wx.TAB_TRAVERSAL| wx.DP_DROPDOWN)
		self.startPick.Bind(wx.EVT_DATE_CHANGED, self.onStartChange)
		self.endPick = wx.GenericDatePickerCtrl(self, size=(120,-1),style = wx.TAB_TRAVERSAL| wx.DP_DROPDOWN)
		self.endPick.Bind(wx.EVT_DATE_CHANGED, self.onEndChange)
		self.endPick.Enable(False)

		self.mainSizer = wx.BoxSizer(wx.VERTICAL)
		self.pickSizer = wx.BoxSizer(wx.HORIZONTAL)
		self.weekSizer = wx.BoxSizer(wx.HORIZONTAL)
		self.controlSizer = wx.BoxSizer(wx.HORIZONTAL)
		
		self.days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
		self.mainGridSizer = wx.GridSizer(cols=len(self.days),hgap=5,vgap=5)
		self.hours = []
		self.buttons = []
		self.dayBox = {}
		self.dayBoxSizer = {}
		self.hourGridSizer = {}
		self.hourBoxSizer = {}
		self.changesMade = False
		
		# self.startDate = None
		# self.endDate = None
		
		openTime = datetime.datetime.strptime('0800', '%H%M')
		self.hours.append(openTime.strftime('%H%M'))
		hoursOpen = 13
		for i in range(30,60*hoursOpen,30):
			self.hours.append((openTime+datetime.timedelta(minutes=i)).strftime('%H%M'))
		self.closeTime = (datetime.datetime.strptime(self.hours[-1],'%H%M') + datetime.timedelta(minutes=30)).strftime('%H%M')
		
		for day in self.days:
			self.dayBox[day] = wx.StaticBox(self, label= day)
			self.dayBoxSizer[day] = wx.StaticBoxSizer(self.dayBox[day],wx.VERTICAL)
			self.mainGridSizer.Add(self.dayBoxSizer[day],1,wx.EXPAND)
			self.hourGridSizer[day] = wx.GridSizer(cols=1,vgap=4)
			for hour in self.hours:
				if hour[2:] == '00':
					self.hourBoxSizer[day + ':' + hour[:2]+'00']= wx.BoxSizer(wx.HORIZONTAL)
					self.buttons.append(wx.ToggleButton(self,id=len(self.buttons),label=hour))
					self.hourBoxSizer[day + ':' + hour].Add(self.buttons[-1],1,wx.EXPAND | wx.LEFT , 4)
					self.buttons[-1].Bind(wx.EVT_TOGGLEBUTTON, self.buttonToggle)
				else:
					self.buttons.append(wx.ToggleButton(self,id=len(self.buttons),label=hour))
					self.hourBoxSizer[day + ':' + hour[:2]+'00'].Add(self.buttons[-1],1,wx.EXPAND | wx.RIGHT, 4)
					self.buttons[-1].Bind(wx.EVT_TOGGLEBUTTON, self.buttonToggle)
					self.hourGridSizer[day].Add(self.hourBoxSizer[day + ':' + hour[:2]+'00'], 1, wx.EXPAND)
			self.dayBoxSizer[day].Add(self.hourGridSizer[day],1,wx.EXPAND)	
		buttonSpace = 50
		self.reloadButton = wx.Button(self,id=-1,label="RELOAD")
		self.resetButton = wx.Button(self,id=-1,label="RESET")
		self.saveButton = wx.Button(self,id=-1,label="SAVE")
		self.exitButton = wx.Button(self,id=-1,label="EXIT")
		self.controlSizer.Add(self.reloadButton,1,wx.EXPAND | wx.RIGHT, buttonSpace)
		self.controlSizer.Add(self.resetButton,1,wx.EXPAND | wx.RIGHT, buttonSpace)
		self.controlSizer.Add(self.saveButton,1,wx.EXPAND | wx.RIGHT, buttonSpace)
		self.controlSizer.Add(self.exitButton,1,wx.EXPAND | wx.RIGHT, buttonSpace)
		
		self.saveButton.Enable(False)
		self.saveButton.Bind(wx.EVT_BUTTON,self.saveEvent)
		self.reloadButton.Bind(wx.EVT_BUTTON,self.reloadEvent)
		self.resetButton.Bind(wx.EVT_BUTTON,self.resetEvent)
		self.exitButton.Bind(wx.EVT_BUTTON,self.exitEvent)
		
		self.Bind(wx.EVT_CLOSE, self.exitEvent)
		self.pickSizer.Add(self.startPick, 0, wx.ALIGN_CENTER)
		self.pickSizer.AddSpacer(50)
		self.pickSizer.Add(self.endPick, 0, wx.ALIGN_CENTER)
		self.mainSizer.AddSpacer(10)
		self.mainSizer.Add(self.pickSizer,0,wx.ALIGN_CENTER)
		self.mainSizer.Add(self.mainGridSizer,1,wx.EXPAND | wx.ALL,10)
		self.mainSizer.Add(self.controlSizer, 0, wx.ALIGN_CENTER | wx.ALL, 20)
		self.mainSizer.SetSizeHints(self)
		self.SetSizer(self.mainSizer)
		self.Centre()
		self.Layout()
		self.Show()