Commits

_vios committed 306ee55

プログレスダイアログの表示

Comments (0)

Files changed (2)

 #coding:utf8
 import wx
+import wx.lib.agw.hyperlink as hl
 
 class ResultDialog(wx.Dialog):
-    def __init__(self,parent,ID,title=u"更新されたページ",size=wx.DefaultSize,pos=wx.DefaultPosition,
+    def __init__(self,parent,ID,urlList,title=u"更新されたページ",size=(300,100),pos=wx.DefaultPosition,
             style=wx.DEFAULT_DIALOG_STYLE,useMetal=False,):
         #wx.Dialog.__init__(parent,-1,title,size,pos,style)
 
         pre.Create(parent,ID,title,pos,size,style)
         self.PostCreate(pre)
 
+        self.LinkList = []
+
         #put Widgets
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        testST = wx.StaticText(self,-1,"test label")
-        sizer.Add(testST,0,wx.ALIGN_CENTER|wx.ALL,5)
+        if len(urlList) == 0:
+            label = wx.StaticText(self,-1,u"更新されたページはありませんでした")
+            sizer.Add(label,0,wx.ALIGN_CENTER|wx.ALL,5)
+
+        else:
+            label = wx.StaticText(self,-1,u"以下のページが更新されています")
+            sizer.Add(label,0,wx.ALIGN_CENTER|wx.ALL,5)
+
+            for url in urlList:
+                self.LinkList.append(hl.HyperLinkCtrl(self,-1,url,URL=url))
+            for link in self.LinkList:
+                sizer.Add(link,0,wx.ALIGN_CENTER|wx.ALL,5)
+
 
         self.SetSizer(sizer)
         sizer.Fit(self)
 
         self.btAddUrl = wx.Button(self,label=u"URLの追加")
         self.btDelUrl = wx.Button(self,label=u"URLの削除")
-        self.btCheck = wx.Button(self,label=u"フォルダ選択解除")
+        self.btCheck = wx.Button(self,label=u"更新確認")
         #self.buttonDelete = wx.Button(self,label=u"削除")
         self.sizer2.Add(self.btAddUrl,1,wx.EXPAND)
         self.sizer2.Add(self.btDelUrl,1,wx.EXPAND)
         print "dclicked"
 
     def selectCheck(self,e):
-        dlg = ResultDialog.ResultDialog(self,-1)
-        dlg.ShowModal()
+        urlList = webdb.getUrlList()
+        updateUrlList = []
+        max = len(urlList)
+        dlg = wx.ProgressDialog(u"更新確認中...",u"進捗",maximum=max,parent=self,style=wx.PD_APP_MODAL
+                | wx.PD_REMAINING_TIME
+                )
+        keepGoing = True
+        count = 0
+        for url in urlList:
+            if webdb.isUpdate(url):
+                updateUrlList.append(url)
+            count +=1
+            keepGoing,skip = dlg.Update(count)
+
+        dlg.Close()
+        dlg.Destroy()
+        
+        dlg2 = ResultDialog.ResultDialog(self,-1,updateUrlList)
+        dlg2.Show()
     """