示例#1
0
 def __init__(self, parent=None):
     pre = wx.PreFrame()
     XRC().LoadOnFrame(pre, parent, self.RESOURCE_ID)
     self.PostCreate(pre)
     #self.SetMenuBar(XRC().LoadMenuBar(self.MENUBAR_ID))
     self.binder.bindall(self, self.RESOURCE_ID)
     self.SetIcon(main_icon.getIcon())
示例#2
0
 def __init__(self, parent=None, fname=None, orbit=[]):
   wx.Frame.__init__(self, parent, title=APP_TITLE,
     pos=DEFAULT_POS, size=DEFAULT_SIZE)
   self.th, self.t = None, None
   self.SetIcon(main_icon.getIcon())
   self.SetBackgroundColour('White')
   szh = wx.BoxSizer(wx.HORIZONTAL)
   self.tp = TurtlePanel(self, orbit)
   szh.Add(self.tp, 0, wx.FIXED)
   p = wx.Panel(self)
   # p.SetBackgroundColour('Green')
   szv = wx.BoxSizer(wx.VERTICAL)
   lbl = wx.StaticText(p, wx.NewId(), APP_USAGE)
   szv.Add(lbl, 1, wx.EXPAND | wx.ALIGN_TOP | wx.ALIGN_LEFT)
   self.chkplst = wx.CheckBox(p, wx.NewId(), u'Path (Pen, Angle and Length)')
   szv.Add(self.chkplst, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_LEFT)
   self.plst = PALListCtrl(p, wx.NewId())
   szv.Add(self.plst, 0, wx.EXPAND | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT)
   self.txtpc = wx.StaticText(p, wx.NewId(), u'Path count:')
   szv.Add(self.txtpc, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_LEFT)
   self.chkrlst = wx.CheckBox(p, wx.NewId(), u'Undo / Redo buffer')
   szv.Add(self.chkrlst, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_LEFT)
   self.rlst = PALListCtrl(p, wx.NewId())
   szv.Add(self.rlst, 0, wx.EXPAND | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT)
   self.txtrd = wx.StaticText(p, wx.NewId(), u'Redo count:')
   szv.Add(self.txtrd, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_LEFT)
   self.txtnx = wx.StaticText(p, wx.NewId(), u'X:')
   szv.Add(self.txtnx, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_LEFT)
   self.txtny = wx.StaticText(p, wx.NewId(), u'Y:')
   szv.Add(self.txtny, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_LEFT)
   self.flst = wx.ListBox(p, wx.NewId(), size=DEFAULT_LISTWH)
   szv.Add(self.flst, 0, wx.EXPAND | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT)
   btnload = wx.Button(p, wx.NewId(), u'load')
   szv.Add(btnload, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT)
   btnclear = wx.Button(p, wx.NewId(), u'clear')
   szv.Add(btnclear, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT)
   btntest = wx.Button(p, wx.NewId(), u'testdraw')
   szv.Add(btntest, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT)
   self.txtname = wx.TextCtrl(p, wx.NewId(),
     os.path.splitext(os.path.basename(fname))[0] if fname else APP_FILE)
   # size=DEFAULT_LISTWH, style=wx.TE_MULTILINE)
   szv.Add(self.txtname, 0, wx.EXPAND)
   btnsave = wx.Button(p, wx.NewId(), u'save')
   szv.Add(btnsave, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT)
   btnquit = wx.Button(p, wx.NewId(), u'quit')
   szv.Add(btnquit, 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT)
   p.SetSizer(szv)
   szh.Add(p, 1, wx.EXPAND)
   self.SetSizer(szh)
   self.initFileList()
   self.Bind(wx.EVT_CHECKBOX, self.OnCBplstClicked, self.chkplst)
   self.Bind(wx.EVT_CHECKBOX, self.OnCBrlstClicked, self.chkrlst)
   self.Bind(wx.EVT_LISTBOX, self.OnLBflstSelected, self.flst)
   self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnLBflstDClicked, self.flst)
   self.Bind(wx.EVT_BUTTON, self.OnBtnLoad, btnload)
   self.Bind(wx.EVT_BUTTON, self.OnBtnClear, btnclear)
   self.Bind(wx.EVT_BUTTON, self.OnBtnTest, btntest)
   self.Bind(wx.EVT_BUTTON, self.OnBtnSave, btnsave)
   self.Bind(wx.EVT_BUTTON, self.OnBtnQuit, btnquit)
   self.Bind(wx.EVT_CLOSE, self.OnClose) # trap [x]
   if len(orbit): self.OnBtnTest(None)
示例#3
0
 def __init__(self, *args, **kwargs):
   super(MyFrame, self).__init__(title=APPTITLE,
     size=(800, 600), pos=(520, 240), *args, **kwargs)
   self.SetIcon(main_icon.getIcon()) # img2py -i main_icon.ico main_icon.py
   hsz = wx.BoxSizer(wx.HORIZONTAL)
   vpnl = wx.Panel(self, -1)
   vpnl.SetBackgroundColour(wx.Colour(240, 192, 32))
   vsz00 = wx.BoxSizer(wx.VERTICAL)
   self.clock = wx.StaticText(vpnl, -1, u'動作速度 clock %dms' % INTERVAL)
   vsz00.Add(self.clock, 0, wx.EXPAND)
   self.clockslider = wx.Slider(vpnl, wx.NewId(), INTERVAL, 1, 500)
   vsz00.Add(self.clockslider, 0, wx.EXPAND)
   self.timesfirst = wx.StaticText(vpnl, -1, u'最初に開く場所 7ヶ所')
   vsz00.Add(self.timesfirst, 0, wx.EXPAND)
   self.timesfirstslider = wx.Slider(vpnl, wx.NewId(), 7, 1, 20)
   vsz00.Add(self.timesfirstslider, 0, wx.EXPAND)
   self.timestrunc = wx.StaticText(vpnl, -1, u'下の行動に遷移するまで 2')
   vsz00.Add(self.timestrunc, 0, wx.EXPAND)
   self.timestruncslider = wx.Slider(vpnl, wx.NewId(), 2, 2, 200)
   vsz00.Add(self.timestruncslider, 0, wx.EXPAND)
   self.choices = [u'じっくり考える', u'助言を待つ', u'適当に開く']
   self.suggestion = wx.RadioBox(vpnl, wx.NewId(), u'知識不足/煮詰まったとき',
     choices=self.choices, majorDimension=3, style=wx.RA_SPECIFY_COLS)
   self.suggestion.EnableItem(0, False)
   self.suggestion.SetSelection(2)
   vsz00.Add(self.suggestion, 0, wx.EXPAND)
   hsz0 = wx.BoxSizer(wx.HORIZONTAL)
   self.stmisscont = wx.StaticText(vpnl, -1, u'失敗時の自動リトライ')
   hsz0.Add(self.stmisscont, 1, wx.EXPAND)
   self.misscont1 = wx.CheckBox(vpnl, wx.NewId(), u'序盤')
   self.misscont1.SetValue(True)
   hsz0.Add(self.misscont1, 0, wx.EXPAND)
   self.misscont2 = wx.CheckBox(vpnl, wx.NewId(), u'序盤以外')
   self.misscont2.SetValue(True)
   hsz0.Add(self.misscont2, 0, wx.EXPAND)
   vsz00.Add(hsz0, 0, wx.EXPAND)
   self.btnpause = wx.Button(vpnl, wx.NewId(), u'Pause')
   vsz00.Add(self.btnpause, 0, wx.EXPAND)
   hsz00 = wx.BoxSizer(wx.HORIZONTAL)
   self.showinfer = wx.CheckBox(vpnl, wx.NewId(), u'推論状態表示')
   self.showinfer.SetValue(False)
   hsz00.Add(self.showinfer, 1, wx.EXPAND)
   self.showdict = wx.CheckBox(vpnl, wx.NewId(), u'辞書検出表示')
   self.showdict.SetValue(True)
   hsz00.Add(self.showdict, 1, wx.EXPAND)
   self.showmap = wx.CheckBox(vpnl, wx.NewId(), u'内部状態表示')
   self.showmap.SetValue(False)
   hsz00.Add(self.showmap, 1, wx.EXPAND)
   vsz00.Add(hsz00, 0, wx.EXPAND)
   self.txt = wx.TextCtrl(vpnl, style=wx.TE_MULTILINE)
   vsz00.Add(self.txt, 3, wx.EXPAND)
   self.ptn = wx.TextCtrl(vpnl, style=wx.TE_MULTILINE)
   vsz00.Add(self.ptn, 3, wx.EXPAND)
   self.msg = wx.TextCtrl(vpnl, style=wx.TE_MULTILINE)
   vsz00.Add(self.msg, 2, wx.EXPAND)
   vpnl.SetSizer(vsz00)
   hsz.Add(vpnl, 1 if GENERATE_CHKBMP else 4, wx.EXPAND)
   vsz01 = wx.BoxSizer(wx.VERTICAL)
   self.map = wx.TextCtrl(self, style=wx.TE_MULTILINE)
   self.map.SetFont(wx.Font(8, wx.TELETYPE, wx.NORMAL, wx.NORMAL)) # wx.MODERN
   vsz01.Add(self.map, 4, wx.EXPAND)
   self.cap = wx.Panel(self, size=(PANELHW, PANELHH))
   vsz01.Add(self.cap, 5, wx.EXPAND)
   hsz.Add(vsz01, 3 if GENERATE_CHKBMP else 7, wx.EXPAND)
   self.SetSizer(hsz)
   self.btd = BTD.BalloonTipDict(main_icon.getBitmap())
   self.blnclock = self.btd.get(self, 'clock')
   self.blntimestrunc = self.btd.get(self, 'timestrunc')
   self.blnstmisscont = self.btd.get(self, 'stmisscont')
   wx.CallAfter(self.setup)
示例#4
0
	def __init__(self, parent=None):
		#from pit import Pit
		#twUserdata = Pit.get('twitter.com',{'require' : {'user':'','pass':''}})
		twUserdata = self.loadUserData(".chat/twdata")
		twTabConfig = self.loadUserData(".chat/tabconfig")

		wx.Frame.__init__(self,None, -1, "crochet")
		
		self.CreateStatusBar()

		self.selectedRow = -1
		text = self.text = wx.TextCtrl(self,-1,style=wx.TE_PROCESS_ENTER)
		text.Bind(wx.EVT_TEXT_ENTER, self.OnSendTW)
		button = self.button = wx.Button(self, -1, "Send")
		self.button.Bind(wx.EVT_BUTTON, self.OnSendTW) 
	
		notebook = self.notebook = wx.Notebook(self,-1,style=wx.NB_BOTTOM|wx.NB_MULTILINE)

		self.imageThreadLock = thread.allocate_lock()
		self.httpThreadLock = thread.allocate_lock()
		self.dataListThreadLock = thread.allocate_lock()	
		filter = []
		for f in twTabConfig['tabFilter']:
			filter.append(BranchFilter(f[0],f[1],f[2],f[3],f[4],f[5],f[6])	)	
		
		self.recentPage = RecentPage(self,self.httpThreadLock,filter)
		self.replyPage = ReplyPage(self,self.httpThreadLock)
		self.directPage = DMPage(self,self.httpThreadLock) 

		for p in twTabConfig['tabName']:
			page = CustomPage(p,self,self.httpThreadLock)
			self.recentPage.AppendCustomPage(page,p)	
		
		inputSizer = wx.BoxSizer(wx.HORIZONTAL)
		inputSizer.Add(self.text,2)
		inputSizer.Add(self.button,0)
		

		messageText=self.messageText = wx.TextCtrl(self,-1,style=wx.TE_MULTILINE|wx.TE_AUTO_URL|wx.TE_READONLY,size=(-1,65))
		userIcon = self.userIcon = wx.StaticBitmap(self,-1,wx.NullBitmap,(0,0),(64,64))
		userName = self.userName = wx.StaticText(self,-1,"test")
		twitTime = self.twitTime = wx.StaticText(self,-1,"---")
		
		messageSizer3 = wx.BoxSizer(wx.HORIZONTAL)
		messageSizer3.Add(userName,1,wx.EXPAND)
		messageSizer3.Add(twitTime,1,wx.EXPAND)

		messageSizer2 = wx.BoxSizer(wx.VERTICAL)
		messageSizer2.Add(messageSizer3,0,wx.EXPAND)
		messageSizer2.Add(messageText,0,wx.EXPAND)
		
		messageSizer1 = wx.BoxSizer(wx.HORIZONTAL)
		messageSizer1.Add(userIcon,0,wx.EXPAND)
		messageSizer1.Add(messageSizer2,1,wx.EXPAND)
	
		messageSizer = wx.BoxSizer(wx.VERTICAL)	
		messageSizer.Add(messageSizer1,0,wx.EXPAND)
		messageSizer.Add(inputSizer,0,wx.EXPAND)
		
		self.sizer = wx.BoxSizer(wx.VERTICAL)
		self.sizer.Add(notebook,2,wx.EXPAND)
		self.sizer.Add(messageSizer,0,wx.EXPAND)

		
		self.SetSizer(self.sizer)
		self.SetAutoLayout(True)
		inputSizer.Fit(self)
		self.sizer.Fit(self)
	
		self.tw = twitter3.Twitter(twUserdata)
		self.tw.setAuthService("twitter")
		self.SetIcon(main_icon.getIcon())
		self.SetSize((300,400))
		self.timer = wx.Timer(self,self.TIMER_ID)
		wx.EVT_TIMER(self,self.TIMER_ID,self.OnUpdate)
		self.timer.Start(60000)
		
		self.timer11 = wx.Timer(self,self.TIMER_ID3+1)
		wx.EVT_TIMER(self,self.TIMER_ID3+1,self.OnUpdate2)
		self.timer11.Start(3000)

		self.timer2 = wx.Timer(self,self.TIMER_ID2)
		wx.EVT_TIMER(self,self.TIMER_ID2,self.OnReplyUpdate)
		self.timer2.Start(300000)
		
		self.timer3 = wx.Timer(self,self.TIMER_ID3)
		wx.EVT_TIMER(self,self.TIMER_ID3,self.OnDMUpdate)
		self.timer3.Start(300000)
		self.RefleshTw()

		self.replyPage.Reflesh()
		self.directPage.Reflesh()

		self.SetNowTime2StatusBar()
示例#5
0
	def __init__(self, parent=None):
		#from pit import Pit
		#twUserdata = Pit.get('twitter.com',{'require' : {'user':'','pass':''}})
		try:
			twUserdata = self.loadUserData(".chat/twdata")
		except:
			twUserdata = configDialog.ConfigDialog(None, -1, 'crochet config').GetAccount()
			if twUserdata["user"] and twUserdata["pass"]:
				file = open(".chat/twdata","w")
				file.write("{\"user\":\""+twUserdata["user"]+
					   "\",\"pass\":\""+twUserdata["pass"]+"\"}\n")
				file.close()
			else:
				exit(1)
		twTabConfig = self.loadUserData(".chat/tabconfig")

		wx.Frame.__init__(self,None, -1, "crochet")
		
		if g_growl == True:
			self.g = Growl.GrowlNotifier(
				applicationName='crochet',notifications=['newTwit','newReply'])
			self.g.register()
			self.img = Growl.Image.imageFromPath('reply.png')	
		self.CreateStatusBar()

		self.selectedRow = -1
		text = self.text = wx.TextCtrl(self,-1,style=wx.TE_PROCESS_ENTER)
		text.Bind(wx.EVT_TEXT_ENTER, self.OnSendTW)
		button = self.button = wx.Button(self, -1, "Send")
		self.button.Bind(wx.EVT_BUTTON, self.OnSendTW) 
	
		notebook = self.notebook = wx.aui.AuiNotebook(self,-1,style=wx.aui.AUI_NB_BOTTOM|wx.aui.AUI_NB_WINDOWLIST_BUTTON|wx.aui.AUI_NB_TAB_SPLIT)

		self.imageThreadLock = thread.allocate_lock()
		self.httpThreadLock = thread.allocate_lock()
		self.dataListThreadLock = thread.allocate_lock()	
		filter = []
		for f in twTabConfig['tabFilter']:
			filter.append(BranchFilter(f[0],f[1],f[2],f[3],f[4],f[5],f[6])	)	
		
		self.recentPage = RecentPage(self,self.httpThreadLock,filter)
		self.replyPage = ReplyPage(self,self.httpThreadLock)
		self.directPage = DMPage(self,self.httpThreadLock) 

		for p in twTabConfig['tabName']:
			page = CustomPage(p,self,self.httpThreadLock)
			self.recentPage.AppendCustomPage(page,p)
		
		inputSizer = wx.BoxSizer(wx.HORIZONTAL)
		inputSizer.Add(self.text,2)
		inputSizer.Add(self.button,0)

		#messageText=self.messageText = wx.TextCtrl(self,-1,style=wx.TE_MULTILINE|wx.TE_AUTO_URL|wx.TE_READONLY,size=(-1,65))
		messageText = self.messageText = TwitHtml(self)
		userIcon = self.userIcon = wx.StaticBitmap(self,-1,wx.NullBitmap,(0,0),(64,64))
		userName = self.userName = wx.StaticText(self,-1,"test")
		twitTime = self.twitTime = wx.StaticText(self,-1,"---")
		
		messageSizer3 = wx.BoxSizer(wx.HORIZONTAL)
		messageSizer3.Add(userName,2,wx.EXPAND)
		messageSizer3.Add(twitTime,3,wx.EXPAND,wx.ALIGN_RIGHT)

		messageSizer2 = wx.BoxSizer(wx.VERTICAL)
		messageSizer2.Add(messageSizer3,0,wx.EXPAND)
		messageSizer2.Add(messageText,0,wx.EXPAND)
		
		messageSizer1 = wx.BoxSizer(wx.HORIZONTAL)
		messageSizer1.Add(userIcon,0,wx.EXPAND)
		messageSizer1.Add(messageSizer2,1,wx.EXPAND)
	
		messageSizer = wx.BoxSizer(wx.VERTICAL)	
		messageSizer.Add(messageSizer1,0,wx.EXPAND)
		messageSizer.Add(inputSizer,0,wx.EXPAND)
		
		self.sizer = wx.BoxSizer(wx.VERTICAL)
		self.sizer.Add(notebook,2,wx.EXPAND)
		self.sizer.Add(messageSizer,0,wx.EXPAND)
		
		self.SetSizer(self.sizer)
		self.SetAutoLayout(True)
		inputSizer.Fit(self)
		self.sizer.Fit(self)
	
		self.tw = twitter3.Twitter(twUserdata)
		self.tw.setAuthService("twitter")
		self.SetIcon(main_icon.getIcon())
		self.SetSize((600,400))
		self.timer = wx.Timer(self,self.TIMER_ID)
		wx.EVT_TIMER(self,self.TIMER_ID,self.OnUpdate)
		self.timer.Start(60000)
		
		self.timer11 = wx.Timer(self,self.TIMER_ID3+1)
		wx.EVT_TIMER(self,self.TIMER_ID3+1,self.OnUpdate2)
		self.timer11.Start(3000)

		self.timer2 = wx.Timer(self,self.TIMER_ID2)
		wx.EVT_TIMER(self,self.TIMER_ID2,self.OnReplyUpdate)
		self.timer2.Start(300000)
		
		self.timer3 = wx.Timer(self,self.TIMER_ID3)
		wx.EVT_TIMER(self,self.TIMER_ID3,self.OnDMUpdate)
		self.timer3.Start(300000)
		
		self.RefreshTw()
		self.replyPage.Refresh()
		self.directPage.Refresh()

		self.SetNowTime2StatusBar()
		self.CreateMenu()