Exemplo n.º 1
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)
        ##self.SetBackgroundColour("sky blue")

        StaticText(self, -1, "This is an example of static text", (20, 10))
        StaticText(self, -1, "using the wx.StaticText Control.", (20, 30))

        StaticText(self, -1, "Is this yellow?", (20, 70),
                   (120, -1)).SetBackgroundColour('Yellow')

        StaticText(self, -1, "align center", (160, 70), (120, -1),
                   wx.ALIGN_CENTER).SetBackgroundColour('Yellow')

        StaticText(self, -1, "align right", (300, 70), (120, -1),
                   wx.ALIGN_RIGHT).SetBackgroundColour('Yellow')

        str = "This is a different font."
        text = StaticText(self, -1, str, (20, 120))
        font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.NORMAL)
        text.SetFont(font)

        StaticText(
            self, -1,
            "Multi-line wx.StaticText\nline 2\nline 3\n\nafter empty line",
            (20, 170))
        StaticText(
            self,
            -1,
            "Align right multi-line\nline 2\nline 3\n\nafter empty line",
            (220, 170),
            style=wx.ALIGN_RIGHT)
Exemplo n.º 2
0
class TdViewAnnotationPanel(wx.Panel):
    '''
    The view annotation area.

    This area can be used to plot anotations for the view. This might be 
    some statistic values (e.g. min, max), the axes limits or some 
    other custom info.
    '''
    def __init__(self, parent, size=(200, -1), color=None):
        wx.Panel.__init__(self, parent, size=size)
        self.SetBackgroundColour(color)
        self.SetMinSize((200, -1))

        # Create a test label.
        self.label = StaticText(self, wx.ID_ANY, "view annotation area",
                                (20, 10))
        font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL)
        self.label.SetFont(font)

        # Add the label to the sizer.
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.label, 1, wx.EXPAND | wx.ALL, border=0)
        self.SetSizer(sizer)

        #print label.GetAlignment()

    def setLabel(self, text):
        ''' Set the text of the annotation label.
        '''
        self.label.SetLabelText(text)
        self.label.Refresh()
Exemplo n.º 3
0
    def MakeToolBar(self):
        TBFLAGS = (wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT)
        tb = self.CreateToolBar(TBFLAGS)
        tsize = (24, 24)
        catagory_new_bmp = images.catagory_new.GetBitmap()
        goods_new_bmp = images.goods_new.GetBitmap()
        tb.SetToolBitmapSize(tsize)

        tb.AddTool(10, "新增类别", catagory_new_bmp, wx.NullBitmap, wx.ITEM_NORMAL,
                   "新增类别", "增加物品类别,用于物品归类,便于物品管理'", None)
        tb.AddTool(20, "新增物品", goods_new_bmp, wx.NullBitmap, wx.ITEM_NORMAL,
                   "新增物品", "添加新的物品", None)
        self.Bind(wx.EVT_TOOL, self.OnAddCatagory, id=10)
        self.Bind(wx.EVT_TOOL, self.OnAddGoods, id=20)

        tb.AddStretchableSpace()
        login_msg = '您好,{},欢迎使用系统! '.format(
            userservice.get_current_user().get('username'))
        login_info = wx.StaticText(tb, wx.ID_ANY, login_msg)
        tb.AddControl(login_info)
        tb.AddSeparator()

        bmp = StaticBitmap(tb, -1, images.setting.GetBitmap())
        tb.AddControl(bmp)
        modifypass_lb = StaticText(tb, -1, "修改密码")
        tb.AddControl(modifypass_lb)
        modifypass_lb.Bind(wx.EVT_MOUSE_EVENTS, self.OnModifyPassword)

        tb.Realize()
Exemplo n.º 4
0
    def UpdateText(self):
        text = StaticText(self, -1, self.sent, (20, 430))
        text.SetBackgroundColour('White')
        font = wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL)
        text.SetFont(font)

        return(0)
Exemplo n.º 5
0
def getStaticTextBuff(parent, id, text, pos, size, bCreate=True):
    """
    Возвращает StaticText из буфера либо создает новый.
    """
    global staticTextBuff
    _uuid = parent._uuid
    bBuff = False

    if _uuid not in staticTextBuff or bCreate:
        statTextCtrl = GenStaticText(parent, -1, text, pos, size)
    else:
        try:
            statTextCtrl = staticTextBuff[_uuid].pop(0)
            statTextCtrl.SetPosition(pos)
            statTextCtrl.SetSize(size)
            statTextCtrl.SetLabel(text)

            font = icFont({})
            statTextCtrl.SetFont(font)
            statTextCtrl.Show(True)
            bBuff = True
        except:
            LogLastError('GIVE FROM BUFF ERROR')
            staticTextBuff = {}
            statTextCtrl = GenStaticText(parent, -1, text, pos, size)

    return bBuff, statTextCtrl
Exemplo n.º 6
0
    def __init__(self, parent, id=-1, label="", pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=0, name="staticText", URL=""):
        """
        Default class constructor.

        Pass URL == "" to use the label as the url link to navigate to
        """

        StaticText.__init__(self, parent, id, label, pos, size,
                            style, name)

        if URL.strip() == "":
            self._URL = label
        else:
            self._URL = URL

        # Set Tooltip
        self.SetToolTip(wx.ToolTip(self._URL))

        # Set default properties
        # default: True
        self.ReportErrors()

        # default: True, True, True
        self.SetUnderlines()

        # default: blue, violet, blue
        self.SetColours()

        # default: False
        self.SetVisited()

        # default: False
        self.EnableRollover()

        # default: False
        self.SetBold()

        # default: wx.CURSOR_HAND
        self.SetLinkCursor()

        # default True
        self.AutoBrowse()

        # default True
        self.DoPopup()

        # default False
        self.OpenInSameWindow()

        # Set control properties and refresh
        self.UpdateLink(True)

        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseEvent)
        self.Bind(wx.EVT_MOTION, self.OnMouseEvent)
Exemplo n.º 7
0
 def __init__(self,
              parent,
              ID,
              label,
              pos=wx.DefaultPosition,
              size=wx.DefaultSize,
              style=0):
     """
     """
     self._bRepaint = True
     GenStaticText.__init__(self, parent, ID, label, pos, size, style)
Exemplo n.º 8
0
 def __init__(self,
              parent,
              id=wx.ID_ANY,
              label='',
              margin=0,
              *args,
              **kwds):
     self._margin = margin
     self._initialLabel = label
     self.init = False
     GenStaticText.__init__(self, parent, id, label, *args, **kwds)
     self.Bind(wx.EVT_SIZE, self.OnSize)
Exemplo n.º 9
0
class RemoveFilesDialog(ActionDialog):
    """删除文件的对话框"""
    def __init__(self, parent, fileName):
        """初始方法 parent为父对象"""
        self.fileName = fileName
        self.parent = parent
        '''
        self.parent.SysMessaegText.WriteText
        使用父对象的消息框输出消息
        '''
        ActionDialog.__init__(self, u"删除文件")

        StaticText(self.actionPanel, -1, u"您确认要对选择的文件进行删除吗?", (80, 80))

        #操作中提示
        self.actiontext = StaticText(self.actionPanel, -1, u"正在操作,请稍等...",
                                     (160, 250))
        self.actiontext.Show(False)

        self.ok = wx.Button(self.actionPanel, -1, u"确   定", (100, 200))
        self.ok.SetForegroundColour("#006699")
        self.cancel = wx.Button(self.actionPanel, -1, u"取   消", (230, 200))
        self.cancel.SetForegroundColour("#006699")

        #确定、取消事件
        self.ok.Bind(wx.EVT_LEFT_DOWN, self.OnDisplayInfo)
        self.ok.Bind(wx.EVT_LEFT_UP, self.OnOk)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancel)

    def OnDisplayInfo(self, event):
        """显示操作信息"""
        self.actiontext.Show(True)

    def OnOk(self, event):
        """确定方法,开始发送上传文件命令"""

        #组合删除文件的命令
        cmd = "cmd=remove,file=" + str(self.fileName)
        #发送删除文件的命令
        SocketUtil.serverSocket.send(str(cmd))
        #接收消息,获得删除命令的返回结果
        self.response = SocketUtil.serverSocket.recv() + '\n'
        """需要修改IOMSERVER的返回值以方便做判断"""
        self.EndModal(wx.ID_OK)

    def OnCancel(self, event):
        """取消方法"""
        self.EndModal(wx.ID_CANCEL)

    def OnGetResponseInfo(self):
        """获得删除文件命令的返回消息"""
        return self.response
Exemplo n.º 10
0
    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent, -1)
        self.log = log
        ##self.SetBackgroundColour("sky blue")

        StaticText(self, -1, "This is an example of static text", (20, 10))
        StaticText(self, -1, "using the wx.StaticText Control.", (20, 30))

        StaticText(self,
                   -1,
                   "align left(default)",
                   pos=(20, 70),
                   size=(120, -1)).SetBackgroundColour('Yellow')

        StaticText(self,
                   -1,
                   "align center",
                   pos=(160, 70),
                   size=(120, -1),
                   style=wx.ALIGN_CENTER).SetBackgroundColour('#FF8000')

        StaticText(self,
                   -1,
                   "align right",
                   pos=(300, 70),
                   size=(120, -1),
                   style=wx.ALIGN_RIGHT).SetBackgroundColour(wx.RED)

        str = "This is a different font."
        text = StaticText(self, -1, str, pos=(20, 120))
        font = wx.Font(18, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                       wx.FONTWEIGHT_NORMAL)
        text.SetFont(font)

        StaticText(self, -1, ("Multi-line wx.StaticText"
                              "\n"
                              "line 2"
                              "\n"
                              "line 3"
                              "\n"
                              "\n"
                              "after empty line"), (20, 170))
        StaticText(self,
                   -1, ("Align right multi-line"
                        "\n"
                        "line 2"
                        "\n"
                        "line 3"
                        "\n"
                        "\n"
                        "after empty line"), (220, 170),
                   style=wx.ALIGN_RIGHT)
Exemplo n.º 11
0
    def __init__(self, parent, id=wx.ID_ANY, label='', pos=(-1, -1), 
                 style=0, name='StyledStaticText', color='#000000'):

        GenStaticText.__init__(self, parent, id, label, pos, style=style, name=name)
        
        label, style, weight = self.parse(label)
        
        self.SetLabel(label)
        self.default = wx.SystemSettings_GetFont(0)
        self.font = wx.Font(self.default.PointSize, self.default.Family, style, weight)

        self.SetFont(self.font)
        self.SetForegroundColour(color)
Exemplo n.º 12
0
    def showUI(self):
        """
        展示用户列表在界面的布局,在该类中如何使用,使用设备上下文将该函数内代码显示的内容,画到屏幕上;
        :return:
        """
        self.main_box = wx.BoxSizer(wx.VERTICAL)
        print("计时器开启计时")

        for usr_card in self.usr_sheet.usersheet:
            # for usr_card in ["usr_card#192.168.1.107#DESKTOP-4423EFF#DESKTOP-4423EFF", "usr_card#192.168.1.107#DESKTOP-4423EFF#DESKTOP-4423EFF"]:
            # print(f"usrspanel {i}")
            # 如何做到将用户列表里面的信息以垂直列表的形式添加到其中。
            # sig_panel = wx.Panel(self)
            head_sizer = wx.GridBagSizer(hgap=5, vgap=5)
            usr_photo = wx.Image("./images/profile_photo_v0.1.png",
                                 wx.BITMAP_TYPE_ANY)
            self.sbm_profile = wx.StaticBitmap(self, -1,
                                               wx.BitmapFromImage(usr_photo))
            self.sbm_profile.Bind(wx.EVT_LEFT_DCLICK, self.pop_chat_window)
            usr_name = usr_card.usr_name()
            # usr_name = usr_card.split("#")[2]
            host_name = usr_card.host_name()
            # host_name = usr_card.split("#")[3]
            print(usr_name)
            self.usr_txt = GenStaticText(self, -1, label="用户名:")
            self.host_txt = GenStaticText(self, -1, label="主机名:")
            self.host_name = GenStaticText(self, -1, label=host_name)
            self.usr_name = GenStaticText(self, -1, label=usr_name)
            # 个人信息状态布局
            head_sizer.Add(self.sbm_profile,
                           pos=(0, 0),
                           span=(2, 1),
                           flag=wx.EXPAND)
            head_sizer.Add(self.usr_txt,
                           pos=(0, 1),
                           flag=wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL)
            head_sizer.Add(self.host_txt,
                           pos=(1, 1),
                           flag=wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL)
            head_sizer.Add(self.usr_name,
                           pos=(0, 2),
                           flag=wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL)
            head_sizer.Add(self.host_name,
                           pos=(1, 2),
                           flag=wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL)

            head_sizer.AddGrowableCol(2)
            # head_sizer.AddGrowableRow(1)
            self.main_box.Add(head_sizer, flag=wx.EXPAND | wx.ALL, border=5)

            self.SetSizerAndFit(self.main_box)
Exemplo n.º 13
0
    def __init__(self, parent, id=-1, label="", pos=(-1, -1), size=(-1, -1), style=0, name="Link", URL=""):

        GenStaticText.__init__(self, parent, id, label, pos, size, style, name)

        self.url = URL

        self.font1 = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, True, "Verdana")
        self.font2 = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False, "Verdana")

        self.SetFont(self.font2)
        self.SetForegroundColour("#0000ff")

        self.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_event)
        self.Bind(wx.EVT_MOTION, self.on_mouse_event)
Exemplo n.º 14
0
    def __init__(self, parent, id = 1, label = '', pos = (-1, -1), \
                 size = (-1, -1), style = 0, name = 'Link', URL = ''):

        GenStaticText.__init__(self, parent, id, label, pos, size, style, name)

        self.url = URL

        self.font1 = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, True, 'Verdana')
        self.font2 = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False, 'Verdana')

        self.SetFont(self.font2)
        self.SetForegroundColour('#0000ff')

        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseEvent)
        self.Bind(wx.EVT_MOTION, self.OnMouseEvent)
Exemplo n.º 15
0
    def __init__(self, parent, label, fonts = [None, None], colours = [None, None], style = 0, parentsizer = None):
        if parentsizer:
            self.parentsizer = parentsizer
        else:
            self.parentsizer = parent

        GenStaticText.__init__(self, parent, -1, label, style = style)
        self.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) 
        
        self.SetFonts(fonts)
        self.SetColours(colours)
        self.Reset()
        
        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseEvent)
        self.Bind(wx.EVT_MOTION, self.OnMouseEvent)
Exemplo n.º 16
0
    def __init__(self, parent, ExecCommandServerList):
        """初始方法 parent为父对象"""
        self.parent = parent
        self.ExecCommandServerList = ExecCommandServerList
        '''
        self.parent.SysMessaegText.WriteText
        使用父对象的消息框输出消息
        '''
        ActionDialog.__init__(self, u"执行命令")

        StaticText(self.actionPanel, -1, u"您确认要发送该命令吗?", (80, 80))

        StaticText(self.actionPanel, -1, u"请输入命令:", (80, 120))

        self.commandstr = wx.TextCtrl(self.actionPanel,
                                      -1,
                                      "", (80, 140),
                                      size=(250, 20))

        #操作中提示
        self.actiontext = StaticText(self.actionPanel, -1, u"正在操作,请稍等...",
                                     (160, 250))
        self.actiontext.Show(False)

        self.ok = wx.Button(self.actionPanel, -1, u"确   定", (100, 200))
        self.ok.SetForegroundColour("#006699")
        self.cancel = wx.Button(self.actionPanel, -1, u"取   消", (230, 200))
        self.cancel.SetForegroundColour("#006699")

        #确定、取消事件
        self.ok.Bind(wx.EVT_LEFT_DOWN, self.OnDisplayInfo)
        self.ok.Bind(wx.EVT_LEFT_UP, self.OnOk)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancel)
Exemplo n.º 17
0
    def __init__(self, fileName, downLoadFileServerList):
        """初始方法"""

        #保存成临时变量
        self.fileName = fileName
        self.downLoadFileServerList = downLoadFileServerList
        ActionDialog.__init__(self, u"文件下载")

        StaticText(self.actionPanel, -1, u"您确认要对选择的服务器进行下载文件的操作吗?", (80, 80))

        StaticText(self.actionPanel, -1, u"请输入保存路径:", (80, 120))

        self.savePath = wx.TextCtrl(self.actionPanel,
                                    -1,
                                    "", (80, 140),
                                    size=(250, 20))

        #操作中提示
        self.actiontext = StaticText(self.actionPanel, -1, u"正在操作,请稍等...",
                                     (160, 250))
        self.actiontext.Show(False)

        self.ok = wx.Button(self.actionPanel, -1, u"确   定", (100, 200))
        self.ok.SetForegroundColour("#006699")
        self.cancel = wx.Button(self.actionPanel, -1, u"取   消", (230, 200))
        self.cancel.SetForegroundColour("#006699")

        #确定、取消事件
        self.ok.Bind(wx.EVT_LEFT_DOWN, self.OnDisplayInfo)
        self.ok.Bind(wx.EVT_LEFT_UP, self.OnOk)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancel)
Exemplo n.º 18
0
    def __init__(self, parent, updateSelfServerList):
        """初始方法 parent为父对象"""
        self.parent = parent
        self.updateSelfServerList = updateSelfServerList
        '''
        self.parent.SysMessaegText.WriteText
        使用父对象的消息框输出消息
        '''
        ActionDialog.__init__(self, u"自更新")

        StaticText(self.actionPanel, -1, u"您确认要对选择的服务器进行自更新操作吗?", (80, 80))

        #操作中提示
        self.actiontext = StaticText(self.actionPanel, -1, u"正在操作,请稍等...",
                                     (160, 250))
        self.actiontext.Show(False)

        self.ok = wx.Button(self.actionPanel, -1, u"确   定", (100, 200))
        self.ok.SetForegroundColour("#006699")
        self.cancel = wx.Button(self.actionPanel, -1, u"取   消", (230, 200))
        self.cancel.SetForegroundColour("#006699")

        #确定、取消事件
        self.ok.Bind(wx.EVT_LEFT_DOWN, self.OnDisplayInfo)
        self.ok.Bind(wx.EVT_LEFT_UP, self.OnOk)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancel)
Exemplo n.º 19
0
    def __init__(self, parent, id=-1, label='', pos=(-1, -1),
        size=(-1, -1), style=0, name=''):

        GenStaticText.__init__(self, parent, id, label, pos, size, style, name)

        self.state_config = Conf().get('state_style')
        font = 'Verdana'
        self.normal_font = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False, font)
        self.underline_font = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, True, font)

        self.SetFont(self.normal_font)
        self.SetForegroundColour('red')
        self.SetBackgroundColour('white')

        self.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_event)
        self.Bind(wx.EVT_MOTION, self.on_mouse_event)
Exemplo n.º 20
0
    def __init__(self, parent, id=-1, label='', pos=(-1, -1),
        size=(-1, -1), style=0, name='Link', text='', textsize=9):

        self.parent = parent
        self.text = text

        GenStaticText.__init__(self, parent, id, label, pos, size, style, name)

        self.font1 = wx.Font(textsize, wx.SWISS, wx.NORMAL, wx.BOLD, True,
                'Verdana')
        self.font2 = wx.Font(textsize, wx.FONTFAMILY_MODERN, wx.NORMAL,
                weight=wx.FONTWEIGHT_BOLD)

        self.SetFont(self.font2)

        self.Bind(wx.EVT_LEFT_UP, self.onMouseEventUp)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.onMouseEventMoving)
Exemplo n.º 21
0
    def __init__(self, parent, label):
        """
        Defsult class constructor.

        :param Window parent: a subclass of :class:`Window`, must not be ``None``;
        :param string `label`: the :class:`AutoWrapStaticText` text label.
        """

        StaticText.__init__(self, parent, -1, label, style=wx.ST_NO_AUTORESIZE)

        self.label = label

        colBg = wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK)
        self.SetBackgroundColour(colBg)
        self.SetOwnForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOTEXT))

        self.Bind(wx.EVT_SIZE, self.OnSize)
Exemplo n.º 22
0
 def _updateLabel(self):
     """Calculates size of wrapped label"""
     parent = self.GetParent()
     newLabel = wordwrap(text=self._initialLabel,
                         width=parent.GetSize()[0],
                         dc=wx.ClientDC(parent),
                         breakLongWords=True,
                         margin=self._margin)
     GenStaticText.SetLabel(self, newLabel)
Exemplo n.º 23
0
    def __init__(self, parent, label):
        """
        Defsult class constructor.

        :param Window parent: a subclass of :class:`Window`, must not be ``None``;
        :param string `label`: the :class:`AutoWrapStaticText` text label.
        """

        StaticText.__init__(self, parent, -1, label, style=wx.ST_NO_AUTORESIZE)

        self.label = label

        colBg = wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK)
        self.SetBackgroundColour(colBg)
        self.SetOwnForegroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOTEXT))

        self.Bind(wx.EVT_SIZE, self.OnSize)
Exemplo n.º 24
0
    def __init__(self):
        wx.Dialog.__init__(self, parent=None, id=-1,title=u"OManager服务器管理 ",style=wx.STAY_ON_TOP)
        self.Center()
        sizer = wx.GridBagSizer(hgap=5, vgap=10)
        self.SetBackgroundColour("#ffffff")
        self.SetIcon(wx.Icon(sys.path[0]+'/img/Loading.ico',wx.BITMAP_TYPE_ICO))
        bmp = wx.Image(sys.path[0]+'/img/title.jpg', wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
        self.logo = wx.StaticBitmap(self, -1, bmp, size=(320, bmp.GetHeight()))
        sizer.Add(self.logo, pos=(0, 0), span=(1,6), flag=wx.EXPAND)
        
        #Loging text
        self.logintext=StaticText(self, -1, u"正在验证,请稍等...", (70, 210))
        self.logintext.Show(False)
        
        # Label
        sizer.Add(wx.StaticText(self, -1, u"用户名: "), pos=(1, 1), flag=wx.ALIGN_RIGHT)
        sizer.Add(wx.StaticText(self, -1, u"密 码: "), pos=(2, 1), flag=wx.ALIGN_RIGHT)
        sizer.Add(wx.StaticText(self, -1, u"私 钥: "), pos=(3, 1), flag=wx.ALIGN_RIGHT)
        
        # Text
        self.username = wx.TextCtrl(self, -1,"", size=(120, 20))
        self.username.SetMaxLength(20)
        self.password = wx.TextCtrl(self, -1,"", size=(120, 20), style=wx.TE_PASSWORD)
        self.password.SetMaxLength(20)
        self.Privatekey = wx.TextCtrl(self, -1,"", size=(160, 20))
        self.Privatekey.SetMaxLength(60)        
        sizer.Add(self.username, pos=(1,2), span=(1,1))
        sizer.Add(self.password, pos=(2,2), span=(1,1))
        sizer.Add(self.Privatekey, pos=(3,2), span=(1,1))
        
        
        # Button
        self.Open = wx.Button(self, -1, u"浏览...", (10, 10))
        #self.Open.SetForegroundColour("#ffffff")
        #self.Open.SetBackgroundColour("#154786")
        self.ok = wx.Button(self, -1, u"登    录", (35, 20))
        self.ok.SetForegroundColour("#FF245D")
        self.cancel = wx.Button(self, -1, u"退   出", (35, 20))
        self.cancel.SetForegroundColour("#006699")

        
        # bind the evt
        self.ok.Bind(wx.EVT_LEFT_DOWN,self.OnDisplayInfo)
        self.ok.Bind(wx.EVT_LEFT_UP, self.OnOK)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancel)
        #self.logo.Bind(wx.EVT_LEFT_DOWN, self.OnCancel)
        self.Bind(wx.EVT_BUTTON, self.OnOpenbutton,self.Open)
        
        sizer.Add(self.ok, pos=(4,1),flag=wx.EXPAND)
        sizer.Add(self.cancel, pos=(4,2))
        sizer.Add(self.Open, pos=(3,3))
        sizer.Add((4, 2), (6, 2))
        #sizer.SetEmptyCellSize((10, 40))
        sizer.AddGrowableCol(3)
        sizer.AddGrowableRow(3)        
        self.SetSizer(sizer)
        self.Fit()
Exemplo n.º 25
0
    def __init__(self, parent, msg, bgColour=None, fgColour=None):
        wx.Frame.__init__(self, parent, style=wx.BORDER_SIMPLE|wx.FRAME_TOOL_WINDOW|wx.STAY_ON_TOP)

        bgColour = bgColour if bgColour is not None else wx.Colour(253, 255, 225)
        fgColour = fgColour if fgColour is not None else wx.BLACK

        panel = wx.Panel(self)
        text = StaticText(panel, -1, msg)

        for win in [panel, text]:
            win.SetCursor(wx.HOURGLASS_CURSOR)
            win.SetBackgroundColour(bgColour)
            win.SetForegroundColour(fgColour)

        size = text.GetBestSize()
        self.SetClientSize((size.width + 60, size.height + 40))
        panel.SetSize(self.GetClientSize())
        text.Center()
        self.Center()
Exemplo n.º 26
0
    def InitUI(self):

        panel = wx.Panel(self)

        vbox = wx.BoxSizer(wx.VERTICAL)
        hbox = wx.BoxSizer(wx.HORIZONTAL)

        st = GenStaticText(panel, label='Go to web site:')
        st.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.BOLD, False, 'Verdana'))
        hbox.Add(st, flag=wx.LEFT, border=20)

        link_wid = Link(panel, label='ZetCode')
        link_wid.SetUrl('http://www.zetcode.com')
        hbox.Add(link_wid, flag=wx.LEFT, border=20)

        vbox.Add(hbox, flag=wx.TOP, border=30)
        panel.SetSizer(vbox)

        self.SetTitle('A Hyperlink')
        self.Centre()
Exemplo n.º 27
0
    def __init__(self, parent, *args, **kwargs):
        wx.Panel.__init__(self, parent, *args, **kwargs)
        self.entry_label = GenStaticText(self,
                                         wx.ID_ANY,
                                         label=" default label ",
                                         size=(-1, 30))
        # Use the default width (-1) and 30 pixel height
        # Set the background color to palegoldenrod
        self.entry_label.SetBackgroundColour('#EEE8AA')

        self.entry = wx.TextCtrl(self, wx.ID_ANY, '')
        self.entry.SetBackgroundColour('#EEE8AA')
        self.entry.SetWindowStyleFlag(wx.TE_PROCESS_ENTER)

        # Arrange the widgets in a horizontal BoxSizer
        dlg_sizer = wx.BoxSizer(wx.HORIZONTAL)

        dlg_sizer.Add(self.entry_label, 1, border=0)
        dlg_sizer.Add(self.entry, 1, wx.EXPAND, border=0)

        self.SetSizer(dlg_sizer)
Exemplo n.º 28
0
    def __init__(self,
                 parent,
                 label,
                 fonts=[None, None],
                 colours=[None, None],
                 style=0,
                 parentsizer=None):
        if parentsizer:
            self.parentsizer = parentsizer
        else:
            self.parentsizer = parent

        GenStaticText.__init__(self, parent, -1, label, style=style)
        self.SetCursor(wx.StockCursor(wx.CURSOR_HAND))

        self.SetFonts(fonts)
        self.SetColours(colours)
        self.Reset()

        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseEvent)
        self.Bind(wx.EVT_MOTION, self.OnMouseEvent)
        self.enter = False
Exemplo n.º 29
0
    def usr_card(self, usr_card):
        ip = usr_card.ip()
        # print("ok")
        head_sizer = wx.GridBagSizer(hgap=5, vgap=5)
        usr_photo = wx.Image("./images/profile_photo_v0.1.png",
                             wx.BITMAP_TYPE_ANY)
        self.sbm_profile = wx.StaticBitmap(self,
                                           -1,
                                           wx.BitmapFromImage(usr_photo),
                                           name=ip)
        self.sbm_profile.Bind(wx.EVT_LEFT_DCLICK, self.pop_chat_window)
        usr_name = usr_card.usr_name()
        self.ip_list.append(ip)
        # usr_name = usr_card.split("#")[2]
        host_name = usr_card.host_name()
        # host_name = usr_card.split("#")[3]
        print(usr_name)
        self.usr_text = GenStaticText(self, -1, label="用户名:", name=ip)
        self.usr_text.Bind(wx.EVT_LEFT_DCLICK, self.pop_chat_window)
        self.host_text = GenStaticText(self, -1, label="IP地址:", name=ip)
        self.host_text.Bind(wx.EVT_LEFT_DCLICK, self.pop_chat_window)
        self.ip = GenStaticText(self, -1, label=ip, name=ip)
        self.ip.Bind(wx.EVT_LEFT_DCLICK, self.pop_chat_window)
        self.usr_name = GenStaticText(self, -1, label=usr_name, name=ip)
        self.usr_name.Bind(wx.EVT_LEFT_DCLICK, self.pop_chat_window)
        # 个人信息状态布局
        head_sizer.Add(self.sbm_profile,
                       pos=(0, 0),
                       span=(2, 1),
                       flag=wx.EXPAND)
        head_sizer.Add(self.usr_text,
                       pos=(0, 1),
                       flag=wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL)
        head_sizer.Add(self.host_text,
                       pos=(1, 1),
                       flag=wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL)
        head_sizer.Add(self.usr_name,
                       pos=(0, 2),
                       flag=wx.EXPAND | wx.ALIGN_CENTER)
        head_sizer.Add(self.ip,
                       pos=(1, 2),
                       flag=wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL)

        head_sizer.AddGrowableCol(2)
        # head_sizer.AddGrowableRow(1)
        self.main_box.Add(head_sizer, flag=wx.EXPAND | wx.ALL, border=5)

        self.SetSizerAndFit(self.main_box)
Exemplo n.º 30
0
class FrameworkStatusBar(wx.StatusBar):
    """A custom status bar for displaying the application version in the bottom
    right corner."""
    def __init__(self, parent, widths, error_delay):
        wx.StatusBar.__init__(self, parent, -1)
        self.error_delay = error_delay

        self.SetFieldsCount(len(widths))
        self.SetStatusWidths(widths)

        self.field_widths = list(widths)
        self.error_control = GenStaticText(self, -1)
        self.error_control.Hide()
        self.message_expire_time = 0
        self.reposition_controls()

        self.expire_timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.on_timer, self.expire_timer)
        self.Bind(wx.EVT_SIZE, self.on_size)

        f = self.GetFont()
        self.error_control.SetFont(
            wx.Font(f.GetPointSize(), f.GetFamily(), f.GetStyle(), wx.BOLD,
                    f.GetUnderlined(), f.GetFaceName(), f.GetEncoding()))
        self.error_control.SetForegroundColour((255, 255, 255))
        self.error_control.SetBackgroundColour((211, 72, 54))

    def on_size(self, event):
        self.reposition_controls()

    def on_timer(self, event):
        self.error_control.Hide()

    def reposition_controls(self):
        rect = self.GetFieldRect(0)
        self.error_control.SetRect(rect)

    def show_error(self, text):
        self.error_control.SetLabel(" " + text)
        rect = self.GetFieldRect(0)
        self.error_control.SetRect(rect)
        self.error_control.Show()
        self.expire_timer.Start(self.error_delay * 1000, oneShot=True)
Exemplo n.º 31
0
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          'Static Text Example',
                          size=(400, 300))
        self.panel = wx.Panel(self, -1)

        self.one = GST(self.panel, wx.NewId(),
                       "This is an example of static text", (100, 10))

        self.rev = GST(self.panel, wx.NewId(),
                       "Static Text With Reversed Colors", (100, 30))
        self.rev.SetForegroundColour('white')
        self.rev.SetBackgroundColour('black')

        self.center = GST(self.panel, wx.NewId(), "align center", (100, 50),
                          (160, -1), wx.ALIGN_CENTER)
        self.center.SetForegroundColour('white')
        self.center.SetBackgroundColour('black')

        self.right = GST(self.panel, wx.NewId(), "align right", (100, 70),
                         (160, -1), wx.ALIGN_RIGHT)
        self.right.SetForegroundColour('white')
        self.right.SetBackgroundColour('black')

        str = "You can also change the font."
        self.text = GST(self.panel, wx.NewId(), str, (20, 100))
        font = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
        self.text.SetFont(font)

        GST(
            self.panel, wx.NewId(), "Your text\ncan be split\n"
            "over multiple lines\n\neven blank ones", (20, 150))
        GST(self.panel,
            wx.NewId(), "Multi-line text\ncan also\n"
            "be right aligned\n\neven with a blank", (220, 150),
            style=wx.ALIGN_RIGHT)
Exemplo n.º 32
0
    def __init__(self, parent, widths, error_delay):
        wx.StatusBar.__init__(self, parent, -1)
        self.error_delay = error_delay

        self.SetFieldsCount(len(widths))
        self.SetStatusWidths(widths)

        self.field_widths = list(widths)
        self.error_control = GenStaticText(self, -1)
        self.error_control.Hide()
        self.message_expire_time = 0
        self.reposition_controls()

        self.expire_timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.on_timer, self.expire_timer)
        self.Bind(wx.EVT_SIZE, self.on_size)

        f = self.GetFont()
        self.error_control.SetFont(
            wx.Font(f.GetPointSize(), f.GetFamily(), f.GetStyle(), wx.BOLD,
                    f.GetUnderlined(), f.GetFaceName(), f.GetEncoding()))
        self.error_control.SetForegroundColour((255, 255, 255))
        self.error_control.SetBackgroundColour((211, 72, 54))
Exemplo n.º 33
0
    def make_test_items(self, features):
        self.alpha_title = GenStaticText(self,
                                         size=(100, -1),
                                         label="Choose Alpha:  ",
                                         style=wx.ALIGN_RIGHT)
        self.alpha_title.SetBackgroundColour((210, 210, 210))
        self.alpha_choice = wx.ComboBox(self,
                                        self.id,
                                        choices=[],
                                        style=wx.CB_READONLY)
        self.toggle_Coeffs([False, False])
        self.gensizer.Add(self.alpha_title, 1)
        self.gensizer.Add(self.alpha_choice, 1)
        self.id += 1

        self.sample_x_choice = ['X' + str(f + 1) for f in features]
        x_title = GenStaticText(self,
                                size=(100, -1),
                                label="Choose X:  ",
                                style=wx.ALIGN_RIGHT)
        x_title.SetBackgroundColour((210, 210, 210))
        self.x_values = np.zeros(len(features))
        self.x_choice = wx.ComboBox(self,
                                    self.id,
                                    choices=self.sample_x_choice,
                                    style=wx.CB_READONLY)
        self.id += 1
        self.x_value = wx.TextCtrl(self, self.id)
        self.x_value.SetBackgroundColour((210, 210, 210))
        self.id += 1
        self.gensizer.Add(x_title, 1)
        self.gensizer.Add(self.x_choice, 0)
        self.gensizer.Add(self.x_value, 1)

        self.alpha_choice.Bind(wx.EVT_COMBOBOX, self.on_alpha_choice_changed)
        self.x_value.Bind(wx.EVT_TEXT, self.on_x_value_changed)
        self.x_choice.Bind(wx.EVT_COMBOBOX, self.on_x_choice_changed)
Exemplo n.º 34
0
 def __init__(self, parent):
     wx.Panel.__init__(self, parent)
 
     # Page indicator
     self.pagenum_txtctrl = GenStaticText(self, label="")
     
     # Page controls
     width = 60
     self.first_btn = NavButton(self, id=ID_FIRST, label='First')
     self.prev_btn = NavButton(self, id=ID_PREV, label='Previous')
     self.next_btn = NavButton(self, id=ID_NEXT, label='Next')
     self.last_btn = NavButton(self, id=ID_LAST, label='Last')
     
     # Arranging layout
     sizer = wx.BoxSizer(wx.HORIZONTAL)
     
     sizer.AddSpacer(1)
     sizer.Add(self.first_btn, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 0)
     sizer.AddSpacer(1)
     sizer.Add(self.prev_btn, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 0)
     
     sizer.AddStretchSpacer(1)
     sizer.Add(self.pagenum_txtctrl, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 0)
     sizer.AddStretchSpacer(1)
     
     sizer.Add(self.next_btn, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 0)
     sizer.AddSpacer(1)
     sizer.Add(self.last_btn, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 0)
     sizer.AddSpacer(1)
     
     self.SetSizer(sizer)
     
     # Bind buttons to events
     self.Bind(wx.EVT_BUTTON, self.change_page_by_button)
     
     # Change text to update position
     self.set_page(0, 0)
Exemplo n.º 35
0
    def __init__(self,
                 parent,
                 id=-1,
                 label='',
                 pos=(-1, -1),
                 size=(-1, -1),
                 style=0,
                 name=''):

        GenStaticText.__init__(self, parent, id, label, pos, size, style, name)

        self.state_config = Conf().get('state_style')
        font = 'Verdana'
        self.normal_font = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False,
                                   font)
        self.underline_font = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, True,
                                      font)

        self.SetFont(self.normal_font)
        self.SetForegroundColour('red')
        self.SetBackgroundColour('white')

        self.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_event)
        self.Bind(wx.EVT_MOTION, self.on_mouse_event)
Exemplo n.º 36
0
    def __init__(self, parent, size=(200, -1), color=None):
        wx.Panel.__init__(self, parent, size=size)
        self.SetBackgroundColour(color)
        self.SetMinSize((200, -1))

        # Create a test label.
        self.label = StaticText(self, wx.ID_ANY, "view annotation area",
                                (20, 10))
        font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL)
        self.label.SetFont(font)

        # Add the label to the sizer.
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.label, 1, wx.EXPAND | wx.ALL, border=0)
        self.SetSizer(sizer)
Exemplo n.º 37
0
    def __init__(self, parent):
        super(StatusbarWidget, self).__init__(parent, style=wx.SB_FLAT)
        self.SetFieldsCount(3)
        self.SetStatusWidths([-6, -1, -1])
        self.size_changed = False

        self._label_info = GenStaticText(self, -1, '')
        self._label_coord = GenStaticText(self, -1, '')
        self._label_simulation = GenStaticText(self, -1, '')

        self.Bind(wx.EVT_SIZE, self.on_size)
        self.Bind(wx.EVT_IDLE, self.on_idle)
Exemplo n.º 38
0
    def SetLabel(self, label, wrapped=False):
        """
        Sets the :class:`AutoWrapStaticText` label.

        All "&" characters in the label are special and indicate that the following character is
        a mnemonic for this control and can be used to activate it from the keyboard (typically
        by using ``Alt`` key in combination with it). To insert a literal ampersand character, you
        need to double it, i.e. use "&&". If this behaviour is undesirable, use :meth:`~Control.SetLabelText` instead.

        :param string `label`: the new :class:`AutoWrapStaticText` text label;
        :param bool `wrapped`: ``True`` if this method was called by the developer using :meth:`~AutoWrapStaticText.SetLabel`,
         ``False`` if it comes from the :meth:`~AutoWrapStaticText.OnSize` event handler.
         
        :note: Reimplemented from :class:`Control`.
        """

        if not wrapped:
            self.label = label

        StaticText.SetLabel(self, label)
Exemplo n.º 39
0
 def __init__(self, parent, wxId, label, style=0):
     StaticText.__init__(self, parent, wxId, label, style=style)
     if host.isWindows():
         # No background.
         self.SetBackgroundStyle(wx.BG_STYLE_SYSTEM)
     wx.EVT_ERASE_BACKGROUND(self, self.clearBack)
Exemplo n.º 40
0
    def __init__(self, parent, id=-1, label="", pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=0, name="staticText", URL=""):
        """
        Default class constructor.

        :param `parent`: the window parent. Must not be ``None``;
        :param `id`: window identifier. A value of -1 indicates a default value;
        :param `label`: the control label;
        :param `pos`: the control position. A value of (-1, -1) indicates a default position,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `size`: the control size. A value of (-1, -1) indicates a default size,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `style`: the window style;
        :param `name`: the window name;
        :param `URL`: a string specifying the url link to navigate to.

        :note: Pass URL="" to use the label as the url link to navigate to.
        """
        
        StaticText.__init__(self, parent, id, label, pos, size,
                            style, name)

        if URL.strip() == "":
            self._URL = label
        else:
            self._URL = URL

        # Set Tooltip
        self.SetToolTip(wx.ToolTip(self._URL))

        # Set default properties
        # default: True
        self.ReportErrors()

        # default: True, True, True
        self.SetUnderlines()

        # default: blue, violet, blue        
        self.SetColours()

        # default: False
        self.SetVisited()

        # default: False 
        self.EnableRollover()

        # default: False        
        self.SetBold()

        # default: wx.CURSOR_HAND        
        self.SetLinkCursor() 

        # default True
        self.AutoBrowse()

        # default True        
        self.DoPopup() 

        # default False
        self.OpenInSameWindow()

        # Set control properties and refresh
        self.UpdateLink(True)

        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseEvent)
        self.Bind(wx.EVT_MOTION, self.OnMouseEvent)        
Exemplo n.º 41
0
 def __init__(self, parent, id=wx.ID_ANY, label='', margin=0, *args, **kwds):
     self._margin = margin
     self._initialLabel = label
     self.init = False
     GenStaticText.__init__(self, parent, id, label, *args, **kwds)
     self.Bind(wx.EVT_SIZE, self.OnSize)