Changeset 18730
- Timestamp:
- 09/03/08 17:44:55 (5 years ago)
- Files:
-
- 1 modified
-
lang/python/crochet/chat_allsrc.py (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/python/crochet/chat_allsrc.py
r18714 r18730 40 40 """ 41 41 class TwDMHttpFrame(wx.Frame): 42 def __init__(self,tw,func ):42 def __init__(self,tw,func,lock): 43 43 self.tw = tw 44 44 self.func = func 45 self.lock = lock 45 46 def start(self): 46 47 thread.start_new_thread(self.run, ()) 47 48 def run(self): 48 49 #ここに通信処理を書く 50 self.lock.acquire() 49 51 a = self.tw.getDM("") 50 52 self.func(a) 53 self.lock.release() 51 54 """ 52 55 twitterにhttpRequestを投げるスレッド 53 56 """ 54 57 class TwReplyHttpFrame(wx.Frame): 55 def __init__(self,tw,func ):58 def __init__(self,tw,func,lock): 56 59 self.tw = tw 57 60 self.func = func 61 self.lock = lock 58 62 def start(self): 59 63 … … 62 66 def run(self): 63 67 #ここに通信処理を書く 68 self.lock.acquire() 64 69 a = self.tw.getReplies("") 65 70 self.func(a) 71 self.lock.release() 66 72 """ 67 73 twitterにhttpRequestを投げるスレッド 68 74 """ 69 75 class TwHttpFrame(wx.Frame): 70 def __init__(self,tw,func ):76 def __init__(self,tw,func,lock): 71 77 self.tw = tw 72 78 self.func = func 79 self.lock = lock 73 80 def start(self): 74 81 thread.start_new_thread(self.run, ()) … … 77 84 #ここに通信処理を書く 78 85 #a = self.tw.get("") 86 self.lock.acquire() 79 87 a = self.tw.getWithScraping("") 80 88 self.func(a) 81 89 self.lock.release() 82 90 """ 83 91 カスタムページ(自分でフィルタリングする) … … 86 94 87 95 dataList = [] 88 def __init__(self, parent ):96 def __init__(self, parent,threadLock): 89 97 90 98 self.owner = parent 99 self.lock = threadLock 91 100 wx.NotebookPage.__init__(self,parent.getNotebook(),-1) 92 101 parent.getNotebook().AddPage(self,'DM') … … 101 110 102 111 def Reflesh(self): 103 t = TwDMHttpFrame(self.owner.tw,self.RefleshList )112 t = TwDMHttpFrame(self.owner.tw,self.RefleshList,self.lock) 104 113 t.start() 105 114 """ … … 109 118 110 119 dataList = [] 111 def __init__(self, parent ):120 def __init__(self, parent,threadLock): 112 121 self.owner = parent 122 self.lock = threadLock 113 123 wx.NotebookPage.__init__(self,parent.getNotebook(),-1) 114 124 parent.getNotebook().AddPage(self,'Recent') … … 205 215 206 216 def Reflesh(self): 207 t = TwHttpFrame(self.owner.tw,self.RefleshList )217 t = TwHttpFrame(self.owner.tw,self.RefleshList,self.lock) 208 218 t.start() 209 219 … … 251 261 self.owner.GetImageListElement(b[4]) 252 262 except: 263 # print "Error:GetImageListElement" 253 264 pass 254 265 i+=1 255 266 self.dataList = dataList + self.dataList 267 print "end setdataList" 256 268 #if self.selectRow != -1 :self.selectRow+=len(dataList) 257 269 … … 259 271 260 272 dataList = [] 261 def __init__(self, parent ):273 def __init__(self, parent,threadLock): 262 274 263 275 self.owner = parent 276 self.lock = threadLock 264 277 wx.NotebookPage.__init__(self,parent.getNotebook(),-1) 265 278 parent.getNotebook().AddPage(self,'Reply') … … 274 287 275 288 def Reflesh(self): 276 t = TwReplyHttpFrame(self.owner.tw,self.RefleshList )289 t = TwReplyHttpFrame(self.owner.tw,self.RefleshList,self.lock) 277 290 t.start() 278 291 … … 281 294 282 295 dataList = [] 283 def __init__(self, parent ):296 def __init__(self, parent,threadLock): 284 297 285 298 self.owner = parent 299 self.lock = threadLock 286 300 wx.NotebookPage.__init__(self,parent.getNotebook(),-1) 287 301 parent.getNotebook().AddPage(self,'DM') … … 296 310 297 311 def Reflesh(self): 298 t = TwDMHttpFrame(self.owner.tw,self.RefleshList )312 t = TwDMHttpFrame(self.owner.tw,self.RefleshList,self.lock) 299 313 t.start() 300 314 pass … … 335 349 notebook = self.notebook = wx.Notebook(self,-1) 336 350 337 self.recentPage = RecentPage(self) 338 self.replyPage = ReplyPage(self) 339 self.directPage = DMPage(self) 351 352 self.imageThreadLock = thread.allocate_lock() 353 self.httpThreadLock = thread.allocate_lock() 354 355 self.recentPage = RecentPage(self,self.httpThreadLock) 356 self.replyPage = ReplyPage(self,self.httpThreadLock) 357 self.directPage = DMPage(self,self.httpThreadLock) 340 358 341 359 inputSizer = wx.BoxSizer(wx.HORIZONTAL) … … 392 410 self.SetNowTime2StatusBar() 393 411 394 self.imageThreadLock = thread.allocate_lock() 412 395 413 def OnSendTW(self, event): 396 414 # 送信する … … 464 482 465 483 #self.userIcon.SetBitmap(self.imageList[unicodeUrl].ConvertToBitmap()) 466 pass484 return self.imageList[unicodeUrl] 467 485 else: 468 486 self.imageList[unicodeUrl] = "" 469 487 self.WebImage2StringIO(url,unicodeUrl) 470 return self.imageList[unicodeUrl]488 return null 471 489 472 490 # Web上の画像を引っ張ってくる … … 485 503 486 504 from cStringIO import StringIO 487 488 505 image_pil = Image.open(StringIO(imageData)) 489 506 image_pil.thumbnail((64,64))
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)