示例#1
0
    def LayoutItems(self):

        self.stc = PythonSTC(self.panel, -1)
        try:
            fid = open("RulerCtrl.py", "rt")
        except:
            fid = open("agw/RulerCtrl.py", "rt")

        text = fid.read()
        fid.close()
        self.stc.SetValue(text)

        self.ruler1 = RC.RulerCtrl(self.panel, -1, orient=wx.HORIZONTAL, style=wx.SUNKEN_BORDER)
        self.ruler2 = RC.RulerCtrl(self.panel, -1, orient=wx.VERTICAL, style=wx.SUNKEN_BORDER)
        self.ruler3 = RC.RulerCtrl(self.panel, -1, orient=wx.HORIZONTAL)

        self.rightbottomsizer_staticbox1 = wx.StaticBox(self.panel, -1, "Options")
        self.rightbottomsizer_staticbox2 = wx.StaticBox(self.panel, -1, "Messages")

        self.rulerformat = wx.ComboBox(self.panel, -1, choices=["Integer", "Real", "Time", "LinearDB"],
                                       style=wx.CB_DROPDOWN|wx.CB_READONLY)
        self.flip = wx.CheckBox(self.panel, -1, "Flip")
        self.logscale = wx.CheckBox(self.panel, -1, "Log Scale")
        self.labelminor = wx.CheckBox(self.panel, -1, "Label")
        self.alwayslabel = wx.CheckBox(self.panel, -1, "Always Label")
        self.csel1 = wx.ColourPickerCtrl(self.panel, -1, wx.WHITE, style=wx.CLRP_USE_TEXTCTRL)
        self.csel2 = wx.ColourPickerCtrl(self.panel, -1, wx.BLACK, style=wx.CLRP_USE_TEXTCTRL)
        self.csel3 = wx.ColourPickerCtrl(self.panel, -1, wx.BLACK, style=wx.CLRP_USE_TEXTCTRL)
        self.messages = wx.TextCtrl(self.panel, -1, "Here You'll See GUI Messages\n",
                                    style=wx.TE_READONLY|wx.TE_MULTILINE)

        self.SetProperties()
        self.DoLayout()

        self.Bind(wx.EVT_COMBOBOX, self.OnComboFormat, self.rulerformat)
        self.Bind(wx.EVT_CHECKBOX, self.OnFlip, self.flip)
        self.Bind(wx.EVT_CHECKBOX, self.OnLogScale, self.logscale)
        self.Bind(wx.EVT_CHECKBOX, self.OnLabelMinor, self.labelminor)
        self.Bind(wx.EVT_CHECKBOX, self.OnAlwaysLabel, self.alwayslabel)
        self.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnBackgroundColour, self.csel1)
        self.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnTickColour, self.csel2)
        self.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnLabelColour, self.csel3)
        self.Bind(wx.EVT_SIZE, self.OnSize)

        self.Bind(RC.EVT_INDICATOR_CHANGING, self.OnIndicatorChanging, id=103)
        self.Bind(RC.EVT_INDICATOR_CHANGED, self.OnIndicatorChanged, id=101, id2=104)
示例#2
0
    def update(self, **kwargs):

        self._update_from_kwargs(**kwargs)
        self._delete_rulers()
        for idx in range(self._n_cols):
            ru = RC.RulerCtrl(self,
                              -1,
                              orient=wx.HORIZONTAL,
                              style=wx.NO_BORDER)
            ru.SetRange(self._start, self._end)
            ru.TickMinor(tick=False)
            ru.SetFlip(True)
            ru.SetTimeFormat(3)
            self.Sizer.Add(ru, 1, wx.ALIGN_LEFT | wx.EXPAND | wx.ALL, 1)

        self.SetAutoLayout(True)
        self.Fit()
        self.GetParent().Layout()