Changeset 28600
- Timestamp:
- 01/18/09 19:10:29 (4 years ago)
- Files:
-
- 1 modified
-
lang/python/crochet/crochet.py (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/python/crochet/crochet.py
r25225 r28600 4 4 import sys,os,time,re 5 5 import wx 6 import wx.lib.ClickableHtmlWindow 6 import wx.lib.ClickableHtmlWindow 7 7 import main_icon 8 8 import urllib … … 17 17 18 18 import config 19 20 """自動で chdirし,working directory を crochet のあるディレクトリにする""" 21 dir = os.path.split(sys.argv[0])[0] 22 os.chdir(dir) 23 19 24 20 25 g_config = {} … … 22 27 g_config['listIcon'] = False 23 28 g_config['popup'] = True 29 g_config['narrowmsg'] = True 24 30 25 31 """自動リサイズするListCtrl""" … … 228 234 list.InsertColumn(0," ",1,20) 229 235 list.InsertColumn(1,u"ユーザ") 230 list.InsertColumn(2,u"発言",0,200) 236 list.InsertColumn(2,u"発言",width=300) 237 list.InsertColumn(3,u"時刻",width=60); 231 238 list.Bind(wx.EVT_LIST_ITEM_SELECTED,self.OnTwitListSelect) 232 239 … … 242 249 mainText = dataList[selectedRow][2] 243 250 mainText = mainText.replace("href=\"/","href=\"http://twitter.com/") 251 252 """ 30文字折り返し""" 253 if g_config['narrowmsg']: 254 tmpTextLen = len(mainText); 255 tmpText = mainText; 256 tmpTagRe = re.compile("(<.+?>)") 257 tmpTagSplit = tmpTagRe.split(tmpText); 258 mainText = "" 259 tb = 30 260 tbc = 0 261 for s in tmpTagSplit: 262 tmplen = len(s); 263 print "s:",s,",",tmplen,",",tbc 264 if tmpTagRe.match(s) != None: 265 mainText += s 266 continue 267 if tbc != 0: 268 if tb <= tbc+tmplen: 269 mainText+=s[0:tb-tbc] 270 mainText += u"<BR>" 271 i = tb-tbc 272 tbc = 0 273 else: 274 mainText+=s 275 tbc += tmplen 276 continue 277 else: i=0 278 279 while i<tmplen-tb: 280 mainText += s[i:i+tb] 281 mainText += u"<BR>" 282 i+=tb 283 if i<tmplen: 284 mainText += s[i:tmplen] 285 tbc+=tmplen-i; 286 244 287 print "mainText",mainText 288 245 289 text.SetValue(mainText) 246 290 label.SetLabel(dataList[selectedRow][1]) … … 341 385 description=gdescription,sticky=False) 342 386 def RemoveATag(self,text): 343 344 387 regATagBegin = re.compile("<a href=.*?>") 345 388 text2 = regATagBegin.sub("",text) … … 374 417 b2.append(b[1]) 375 418 b2.append(self.RemoveATag(b[2])) 376 for j in range(3): 419 b2.append(b[3]); 420 for j in range(4): 377 421 self.list.SetStringItem(i,j,b2[j]) 378 422 … … 474 518 dataListElement.append(x[0]) 475 519 dataListElement.append(x[1]) 476 x2 = toDate2.toDate2(x[2]).strftime("% y-%m-%d %H:%M:%S")520 x2 = toDate2.toDate2(x[2]).strftime("%b %d %H:%M:%S") 477 521 dataListElement.append(x2) 478 522 dataListElement.append(x[3]) … … 499 543 500 544 user = self.owner.tw.user['user'] 501 if g_growl == True and g_config['popup'] :545 if g_growl == True and g_config['popup'] and outCount > 0: 502 546 if outString.find("@"+user) != -1: 503 547 TmpTwitPage.CallGrowl(self,"Recent 新着"+str(outCount)+"件", … … 543 587 #x2 = toDate2.toDate2(x[2]).strftime("%y-%m-%d %H:%M:%S") 544 588 x2 = "--" 589 545 590 dataListElement.append(x2) 546 591 dataListElement.append(x[3]) … … 662 707 wx.Frame.__init__(self,None, -1, "crochet") 663 708 664 665 709 if g_growl == True: 666 710 self.g = Growl.GrowlNotifier( … … 691 735 for p in twTabConfig['tabName']: 692 736 page = CustomPage(p,self,self.httpThreadLock) 693 self.recentPage.AppendCustomPage(page,p) 737 self.recentPage.AppendCustomPage(page,p) 694 738 695 739 inputSizer = wx.BoxSizer(wx.HORIZONTAL) … … 731 775 self.tw.setAuthService("twitter") 732 776 self.SetIcon(main_icon.getIcon()) 733 self.SetSize(( 300,400))777 self.SetSize((600,400)) 734 778 self.timer = wx.Timer(self,self.TIMER_ID) 735 779 wx.EVT_TIMER(self,self.TIMER_ID,self.OnUpdate)
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)