def __init__(self,frame): wx.TaskBarIcon.__init__(self) self.frame = frame self.SetIcon(icon.getwxIcon(), u'shadowsocks') self.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.OnTaskBarLeftDClick) self.Bind(wx.EVT_MENU, self.OnAbout, id=self.ID_About) self.Bind(wx.EVT_MENU, self.ShowFrame, id=self.ID_ShowFrame) self.Bind(wx.EVT_MENU, self.ShowConfig, id=self.ID_ShowConfig) self.Bind(wx.EVT_MENU, self.OnCloseshow, id=self.ID_Closeshow)
def __init__( self, parent=None, id=wx.ID_ANY, title='shadowsocks-wxPython', pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE ): wx.Frame.__init__(self, parent, id, title, pos, size, style) self.SetIcon(icon.getwxIcon()) self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(wx.EVT_ICONIZE, self.OnIconfiy) self.taskBarIcon = TaskBarIcon(self) log = wx.TextCtrl(self, -1, '', size=(500,400), style=wx.TE_MULTILINE|wx.TE_READONLY) self.logr = logging.getLogger('') self.logr.setLevel(logging.DEBUG) hdlr = WxLog(log) hdlr.setFormatter(logging.Formatter('%(levelname)s |%(message)s')) self.logr.addHandler(hdlr)
def __init__(self): wx.Frame.__init__(self, None, -1, title = "Config",size=(300,180)) self.SetIcon(icon.getwxIcon()) panel = wx.Panel(self) gbs = wx.GridBagSizer(5,5) self.st1 = wx.StaticText(panel, label="Server") self.st2 = wx.StaticText(panel, label="Remote Port") self.st3 = wx.StaticText(panel, label="Local Port") self.st4 = wx.StaticText(panel, label="Key") self.tc1 = wx.TextCtrl(panel) self.tc2 = wx.TextCtrl(panel) self.tc3 = wx.TextCtrl(panel) self.tc4 = wx.TextCtrl(panel) self.tc1.SetValue(SERVER) self.tc2.SetValue(str(REMOTE_PORT)) self.tc3.SetValue(str(PORT)) self.tc4.SetValue(KEY) self.button1 = wx.Button(panel, label="Save") self.button2 = wx.Button(panel, label="Cancel") gbs.Add(self.st1, pos=(0,0), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT) gbs.Add(self.st2, pos=(1,0), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT) gbs.Add(self.st3, pos=(2,0), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT) gbs.Add(self.st4, pos=(3,0), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT) gbs.Add(self.tc1, pos=(0,1), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT) gbs.Add(self.tc2, pos=(1,1), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT) gbs.Add(self.tc3, pos=(2,1), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT) gbs.Add(self.tc4, pos=(3,1), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT) gbs.Add(self.button1, pos=(4,0), border=10, flag=wx.LEFT|wx.RIGHT) gbs.Add(self.button2, pos=(4,1), border=10, flag=wx.LEFT|wx.RIGHT) gbs.AddGrowableCol(1) self.Bind(wx.EVT_BUTTON, self.OnCloseWindow, self.button2) self.Bind(wx.EVT_BUTTON, self.SaveConfig, self.button1) panel.SetSizerAndFit(gbs) self.Center() self.Show() self.Raise()