示例#1
0
    def __init__(self, parent, title, values):
        Dialog.__init__(self,
                        parent,
                        title=title,
                        style=DEFAULT_DIALOG_STYLE | RESIZE_BORDER)
        self.values = None

        sizer = GridBagSizer(5, 5)
        row = 0
        self.labels = []
        self.txt_ctrls = []
        for value in values:
            label = StaticText(self, label=value)
            self.labels.append(label)
            sizer.Add(label, pos=(row, 0), flag=ALIGN_RIGHT)

            txtctrl = TextCtrl(self)
            self.txt_ctrls.append(txtctrl)
            sizer.Add(txtctrl, pos=(row, 1), flag=FLAG_ALL_AND_EXPAND)
            row += 1

        self.btn_cancel = Button(self, label=u'Cancel')
        self.btn_cancel.Bind(EVT_BUTTON, self.__on_btn)
        sizer.Add(self.btn_cancel, pos=(row, 0), flag=FLAG_ALL_AND_EXPAND)

        self.btn_ok = Button(self, label=u'OK')
        self.btn_ok.Bind(EVT_BUTTON, self.__on_btn)
        sizer.Add(self.btn_ok, pos=(row, 1), flag=FLAG_ALL_AND_EXPAND)

        sizer.AddGrowableCol(1)
        self.SetSizerAndFit(sizer)
        self.SetSize(400, self.GetSizeTuple()[1])
示例#2
0
    def __init__(self, parent, title=u"NumberInput"):
        Dialog.__init__(self,
                        parent,
                        title=title,
                        size=(320, 240),
                        style=BORDER_NONE)
        pnl = NumberInputWindowPanel(self)

        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_0)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_1)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_2)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_3)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_4)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_5)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_6)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_7)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_8)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_9)
        self.Bind(EVT_BUTTON, pnl.on_input_callback, pnl.keypad_00)

        self.Bind(EVT_BUTTON, pnl.on_delete, pnl.keypad_del)

        self.Bind(EVT_BUTTON, self.on_confirm, pnl.keypad_confirm)
        self.Bind(EVT_BUTTON, self.on_cancel, pnl.keypad_cancel)

        self.pnl = pnl

        # self._set_panel(pnl)
        self._sizer = BoxSizer()
        self._sizer.Clear()
        self._sizer.Add(self.pnl)
        self.SetSizer(self._sizer)
示例#3
0
    def __init__(self, parent, title, values):
        Dialog.__init__(self, parent, title=title, style=DEFAULT_DIALOG_STYLE | RESIZE_BORDER)
        self.values = None

        sizer = GridBagSizer(5, 5)
        row = 0
        self.labels = []
        self.txt_ctrls = []
        for value in values:
            label = StaticText(self, label=value)
            self.labels.append(label)
            sizer.Add(label, pos=(row, 0), flag=ALIGN_RIGHT)

            txtctrl = TextCtrl(self)
            self.txt_ctrls.append(txtctrl)
            sizer.Add(txtctrl, pos=(row, 1), flag=FLAG_ALL_AND_EXPAND)
            row += 1

        self.btn_cancel = Button(self, label=u'Cancel')
        self.btn_cancel.Bind(EVT_BUTTON, self.__on_btn)
        sizer.Add(self.btn_cancel, pos=(row, 0), flag=FLAG_ALL_AND_EXPAND)

        self.btn_ok = Button(self, label=u'OK')
        self.btn_ok.Bind(EVT_BUTTON, self.__on_btn)
        sizer.Add(self.btn_ok, pos=(row, 1), flag=FLAG_ALL_AND_EXPAND)

        sizer.AddGrowableCol(1)
        self.SetSizerAndFit(sizer)
        self.SetSizeWH(400, self.GetSizeTuple()[1])
示例#4
0
    def __init__(self, parent, title=u"Categories", categories=[]):
        Dialog.__init__(self,
                        parent,
                        title=title,
                        size=(320, 240),
                        style=BORDER_NONE)
        pnl = CategoryInputWindowPanel(self, title, categories)

        self.pnl = pnl
        self._sizer = BoxSizer()
        self._sizer.Clear()
        self._sizer.Add(self.pnl)
        self.SetSizer(self._sizer)
示例#5
0
    def __init__(self, parent):
        Dialog.__init__(self,
                        parent,
                        title=u"Entries",
                        size=(320, 240),
                        style=BORDER_NONE)

        pnl = EntryListWindowPanel(self)
        self._pnl = pnl

        self._sizer = BoxSizer()
        self._sizer.Clear()
        self._sizer.Add(self._pnl)
        self.SetSizer(self._sizer)
示例#6
0
    def __init__(self, parent, title, text=None):
        Dialog.__init__(self, parent, title=title, style=DEFAULT_DIALOG_STYLE | RESIZE_BORDER)
        self.SetTitle(title)
        self.SetSizeWH(600, 400)

        sizer = BoxSizer(VERTICAL)

        self.txt_ctrl = TextCtrl(self, style=TE_MULTILINE | TE_READONLY | HSCROLL)
        if text:
            self.txt_ctrl.SetValue(text)
        sizer.Add(self.txt_ctrl, 1, flag=FLAG_ALL_AND_EXPAND)

        self.btn_ok = Button(self, label=u'OK')
        self.btn_ok.Bind(EVT_BUTTON, self.__close)
        sizer.Add(self.btn_ok, flag=CENTER)

        self.SetSizer(sizer)
示例#7
0
    def __init__(self, parent, dpi=(1, 1)):
        Dialog.__init__(self,
                        parent,
                        id=ID_ANY,
                        title=u" 关于 mHosts - v%s" % Settings.version(),
                        pos=DefaultPosition,
                        style=DEFAULT_DIALOG_STYLE | FRAME_FLOAT_ON_PARENT,
                        size=Size(400 * dpi[0], 300 * dpi[1]))
        self.SetSizeHints(DefaultSize, DefaultSize)
        self.SetIcon(Icon(iconPath, BITMAP_TYPE_ICO))
        bSizer2 = BoxSizer(VERTICAL)

        self.aboutDialog = AboutView(self, self.GetSize())
        bSizer2.Add(self.aboutDialog, 0, EXPAND, 0)

        self.SetSizer(bSizer2)
        self.Layout()

        self.Centre(BOTH)
示例#8
0
    def __init__(self, parent, title, text=None):
        Dialog.__init__(self,
                        parent,
                        title=title,
                        style=DEFAULT_DIALOG_STYLE | RESIZE_BORDER)
        self.SetTitle(title)
        self.SetSize(600, 400)

        sizer = BoxSizer(VERTICAL)

        self.txt_ctrl = TextCtrl(self,
                                 style=TE_MULTILINE | TE_READONLY | HSCROLL)
        if text:
            self.txt_ctrl.SetValue(text)
        sizer.Add(self.txt_ctrl, 1, flag=FLAG_ALL_AND_EXPAND)

        self.btn_ok = Button(self, label=u'OK')
        self.btn_ok.Bind(EVT_BUTTON, self.__close)
        sizer.Add(self.btn_ok, flag=CENTER)

        self.SetSizer(sizer)
示例#9
0
    def __init__(self, parent, title, text):
        Dialog.__init__(self, parent, title=title, style=CAPTION | STAY_ON_TOP)
        sizer = BoxSizer(VERTICAL)

        self.label = StaticText(self, label=text)
        sizer.Add(self.label, flag=FLAG_ALL_AND_EXPAND)

        self.gauge = Gauge(self, style=GA_SMOOTH | GA_HORIZONTAL)
        sizer.Add(self.gauge, flag=FLAG_ALL_AND_EXPAND)

        self.close_event = Event()

        def show_progress():
            while not self.close_event.is_set():
                sleep(0.05)
                self.gauge.Pulse()
            self.EndModal(ID_OK)

        self.SetSizerAndFit(sizer)

        run_in_separate_thread(show_progress)
示例#10
0
    def __init__(self, parent, title, text):
        Dialog.__init__(self, parent, title=title, style=CAPTION | STAY_ON_TOP)
        sizer = BoxSizer(VERTICAL)

        self.label = StaticText(self, label=text)
        sizer.Add(self.label, flag=FLAG_ALL_AND_EXPAND)

        self.gauge = Gauge(self, style=GA_SMOOTH | GA_HORIZONTAL)
        sizer.Add(self.gauge, flag=FLAG_ALL_AND_EXPAND)

        self.close_event = Event()

        def show_progress():
            while not self.close_event.is_set():
                sleep(0.05)
                self.gauge.Pulse()
            self.EndModal(ID_OK)

        self.SetSizerAndFit(sizer)

        run_in_separate_thread(show_progress)
示例#11
0
 def __init__(self):
     """Constructor"""
     Dialog.__init__(self, None, title="Bad Cop", size=Size(500, 100))
     ico = Icon('logo.ico', BITMAP_TYPE_ICO)
     self.SetIcon(ico)
     self.message = StaticText(
         self, label="Click Profile, then insert device and click Test")
     self.profile = Button(self, label="Profile")
     self.test = Button(self, label="Test")
     self.test.Disable()
     self.profile.Bind(EVT_BUTTON, self.profileusb)
     self.test.Bind(EVT_BUTTON, self.testusb)
     self.Bind(EVT_CLOSE, self.onclose)
     main_sizer = BoxSizer(VERTICAL)
     t_sizer = BoxSizer(HORIZONTAL)
     p_sizer = BoxSizer(HORIZONTAL)
     t_sizer.Add(self.message, 0, ALL | CENTER, 5)
     p_sizer.Add(self.profile, 0, ALL | CENTER, 5)
     p_sizer.Add(self.test, 0, ALL | CENTER, 5)
     main_sizer.Add(p_sizer, 0, ALL | CENTER, 5)
     main_sizer.Add(t_sizer, 0, ALL | EXPAND | CENTER, 5)
     self.SetSizer(main_sizer)
示例#12
0
    def __init__(self, parent, dpi=(1, 1)):
        Dialog.__init__(self,
                        parent,
                        id=ID_ANY,
                        title=u"编辑/添加Hosts",
                        pos=Point(600, 600),
                        size=Size(394 * dpi[0], 210 * dpi[1]),
                        style=DEFAULT_DIALOG_STYLE | FRAME_FLOAT_ON_PARENT)
        self.__window = parent
        self.SetSizeHints(DefaultSize, DefaultSize)

        font = Font(10, FONTFAMILY_DEFAULT, FONTSTYLE_NORMAL,
                    FONTWEIGHT_NORMAL, False, EmptyString)
        inputSize = Size(260 * dpi[0], -1)
        self.SetFont(font)
        fgSizer3 = FlexGridSizer(0, 2, 0, 0)
        fgSizer3.SetFlexibleDirection(BOTH)
        fgSizer3.SetNonFlexibleGrowMode(FLEX_GROWMODE_SPECIFIED)

        self.localRadio = RadioButton(self, ID_ANY, u"本地Hosts",
                                      DefaultPosition, DefaultSize, 0)
        self.localRadio.SetFont(font)
        fgSizer3.Add(self.localRadio, 0, ALL, 5)
        self.localRadio.Bind(EVT_RADIOBUTTON, self.OnRadioChange)

        self.onlineRadio = RadioButton(self, ID_ANY, u"在线Hosts",
                                       DefaultPosition, DefaultSize, 0)
        fgSizer3.Add(self.onlineRadio, 0, ALL, 5)
        self.onlineRadio.Bind(EVT_RADIOBUTTON, self.OnRadioChange)

        self.m_staticText4 = StaticText(self, ID_ANY, u"名称", DefaultPosition,
                                        DefaultSize, 0)
        self.m_staticText4.Wrap(-1)

        fgSizer3.Add(self.m_staticText4, 0, ALL, 5)

        self.nameInput = TextCtrl(self, ID_ANY, EmptyString, DefaultPosition,
                                  inputSize, 0)
        fgSizer3.Add(self.nameInput, 0, ALL, 5)

        self.m_staticText5 = StaticText(self, ID_ANY, u"地址", DefaultPosition,
                                        DefaultSize, 0)
        self.m_staticText5.Wrap(-1)

        fgSizer3.Add(self.m_staticText5, 0, ALL, 5)

        self.urlInput = TextCtrl(self, ID_ANY, u"http://", DefaultPosition,
                                 inputSize, 0)
        fgSizer3.Add(self.urlInput, 0, ALL, 5)

        self.m_staticText3 = StaticText(self, ID_ANY, u"图标", DefaultPosition,
                                        DefaultSize, 0)
        self.m_staticText3.Wrap(-1)

        fgSizer3.Add(self.m_staticText3, 0, ALL, 5)

        self.iconComboBox = ComboBox(self, ID_ANY, u"请选择图标", DefaultPosition,
                                     inputSize, list(GetIcons().keys()), 0)
        self.iconComboBox.SetFont(font)
        fgSizer3.Add(self.iconComboBox, 0, ALL, 5)

        self.cancelButton = Button(self, ID_ANY, u"取消", DefaultPosition,
                                   DefaultSize, 0)
        fgSizer3.Add(self.cancelButton, 0, ALL, 5)

        self.saveButton = Button(self, ID_ANY, u"保存", DefaultPosition,
                                 DefaultSize, 0)
        fgSizer3.Add(self.saveButton, 0, ALL, 5)

        self.SetSizer(fgSizer3)
        self.Layout()

        self.Centre(BOTH)

        self.cancelButton.Bind(EVT_BUTTON, self.OnButtonClicked)
        self.saveButton.Bind(EVT_BUTTON, self.OnButtonClicked)
        self.Bind(EVT_CLOSE, self.OnClose)