示例#1
0
文件: watcher.py 项目: PatMart/opgen
 def detect_change(self):
     changed = False
     for path in Utils.find_pages(self.directory):
         if path in self.files:
             if self.files[path].has_changed():
                 changed = True
         else:
             changed = True
             self.files[path] = FileWatcher(path)
         continue
     return changed
示例#2
0
 def detect_change(self):
     changed = False
     for path in Utils.find_pages(self.directory):
         if path in self.files:
             if self.files[path].has_changed():
                 changed = True
         else:
             changed = True
             self.files[path] = FileWatcher(path)
         continue
     return changed
示例#3
0
 def _create_new_html(self, pagedir, template_html):
     parser = ContentParser()
     pagefiles = Utils.find_pages(pagedir)
     pagequeue = PriorityQueue()
     numpages = len(pagefiles)
     for pagefile in pagefiles:
         page_obj = parser.file_to_content_dict(pagefile)
         if page_obj['index'].isdigit():
             pagequeue.put([int(page_obj['index']), page_obj])
         else:
             pagequeue.put([numpages, page_obj])
         continue
     return pystache.render(template_html, {'pages':self._page_queue_to_list(pagequeue)})
示例#4
0
 def test_load_files(self):
     dirpath = os.path.dirname(os.path.realpath(__file__))
     pages = Utils.find_pages(dirpath + '/../pages/')
示例#5
0
文件: test.py 项目: PatMart/opgen
 def test_load_files(self):
     dirpath = os.path.dirname(os.path.realpath(__file__))
     pages = Utils.find_pages(dirpath+'/../pages/')