コード例 #1
0
    def show_files(self):

        # If we're not showing identical files, then go through the list
        # and find and remove everything we don't want to see.
        if not self.ui.chkShowSame.isChecked():
            if self.files_nodupes == None:
                self.files_nodupes = set()

                for file in self.files:
                    file1 = os.path.join(self.folder1, file)
                    file2 = os.path.join(self.folder2, file)

                    if not os.path.isfile(file1) or not os.path.isfile(file2):
                        self.files_nodupes.add(file)
                        continue

                    text1 = text_files.load_text(file1)
                    text2 = text_files.load_text(file2)

                    if not text1 == text2:
                        self.files_nodupes.add(file)

            files = self.files_nodupes

        else:
            files = self.files

        # If we're not showing files not present in both directories,
        # go through the list and strip them out.
        if not self.ui.chkNotBoth.isChecked():
            if self.files_missing == None:
                self.files_missing = set()

                for file in self.files:
                    file1 = os.path.join(self.folder1, file)
                    file2 = os.path.join(self.folder2, file)

                    if not os.path.isfile(file1) or not os.path.isfile(file2):
                        self.files_missing.add(file)

            files = files - self.files_missing

        self.ui.treeResults.clear()
        self.ui.treeResults.setHeaderLabel("Results (%d)" % len(files))

        if len(files) > 0:
            tree_items = []

            for file in files:
                file = os.path.normpath(file)
                file = tree.consolidate_path(file)
                tree_item = tree.path_to_tree(file)
                tree_items.append(tree_item)

            tree_items = tree.consolidate_tree_items(tree_items)

            for item in tree_items:
                self.ui.treeResults.addTopLevelItem(item)

            self.ui.treeResults.expandAll()
コード例 #2
0
 def show_files(self):
 
   # If we're not showing identical files, then go through the list
   # and find and remove everything we don't want to see.
   if not self.ui.chkShowSame.isChecked():
     if self.files_nodupes == None:
       self.files_nodupes = set()
     
       for file in self.files:
         file1 = os.path.join(self.folder1, file)
         file2 = os.path.join(self.folder2, file)
         
         if not os.path.isfile(file1) or not os.path.isfile(file2):
           self.files_nodupes.add(file)
           continue
         
         text1 = text_files.load_text(file1)
         text2 = text_files.load_text(file2)
         
         if not text1 == text2:
           self.files_nodupes.add(file)
           
     files = self.files_nodupes
     
   else:
     files = self.files
     
   # If we're not showing files not present in both directories,
   # go through the list and strip them out.
   if not self.ui.chkNotBoth.isChecked():
     if self.files_missing == None:
       self.files_missing = set()
     
       for file in self.files:
         file1 = os.path.join(self.folder1, file)
         file2 = os.path.join(self.folder2, file)
         
         if not os.path.isfile(file1) or not os.path.isfile(file2):
           self.files_missing.add(file)
           
     files = files - self.files_missing
     
   self.ui.treeResults.clear()
   self.ui.treeResults.setHeaderLabel("Results (%d)" % len(files))
   
   if len(files) > 0:
     tree_items = []
     
     for file in files:
       file = os.path.normpath(file)
       file = dir_tools.consolidate_dir(file)
       tree_item = tree.path_to_tree(file)
       tree_items.append(tree_item)
     
     tree_items = tree.consolidate_tree_items(tree_items)
     
     for item in tree_items:
       self.ui.treeResults.addTopLevelItem(item)
     
     self.ui.treeResults.expandAll()
コード例 #3
0
 def search(self):
   text = common.qt_to_unicode(self.ui.txtQuery.text())
   
   dir = common.editor_config.umdimage_dir
   
   if text == "":
     results = []
     self.transHighlighter.clear_keywords()
     self.origHighlighter.clear_keywords()
     self.commHighlighter.clear_keywords()
   else:
     results = self.search_bar(text)
     
     self.transHighlighter.re_flags = self.re_flags
     self.origHighlighter.re_flags = self.re_flags
     self.commHighlighter.re_flags = self.re_flags
     
     if self.ui.chkAdvTrans.isChecked():
       self.transHighlighter.set_keyword(Keyword(text))
     if self.ui.chkAdvOrig.isChecked():
       self.origHighlighter.set_keyword(Keyword(text))
     if self.ui.chkAdvComments.isChecked():
       self.commHighlighter.set_keyword(Keyword(text))
     
   self.ui.treeResults.clear()
   self.ui.treeResults.setHeaderLabel("Results (%d)" % len(results))
   
   if len(results) > 0:
     tree_items = []
     
     for file in results:
       file = os.path.normpath(file)
       file = tree.consolidate_path(file)
       tree_item = tree.path_to_tree(file)
       tree_items.append(tree_item)
     
     tree_items = tree.consolidate_tree_items(tree_items)
     
     for item in tree_items:
       self.ui.treeResults.addTopLevelItem(item)
     
     self.ui.treeResults.expandAll()
コード例 #4
0
 def search(self):
   query = common.qt_to_unicode(self.ui.txtQuery.currentText())
   
   self.ui.txtQuery.removeItem(self.ui.txtQuery.findText(query))
   self.ui.txtQuery.insertItem(0, query)
   self.ui.txtQuery.setCurrentIndex(0)
   
   dir = common.editor_config.data01_dir
   
   if query == "":
     results = []
   else:
     results = self.search_bar(query)
     
   self.ui.treeResults.clear()
   self.ui.treeResults.setHeaderLabel("Results (%d)" % len(results))
   
   if len(results) > 0:
     tree_items = []
     
     for file in results:
       file = os.path.normpath(file)
       file = dir_tools.consolidate_dir(file)
       tree_item = tree.path_to_tree(file)
       tree_items.append(tree_item)
     
     tree_items = tree.consolidate_tree_items(tree_items)
     
     for item in tree_items:
       self.ui.treeResults.addTopLevelItem(item)
     
     self.ui.treeResults.expandAll()
   
   self.ui.txtOriginal.clear()
   self.ui.txtTranslated.clear()
   self.ui.txtComments.clear()
   
   self.update_highlights()