def __init__(self, *args): # Do this first, so we set up interceptors and so on early on try: from gtkusecase import createShortcutBar self.widget = createShortcutBar(uiMapFiles=plugins.findDataPaths([ "*.uimap" ], *args)) self.widget.show() except ImportError: self.widget = gtk.HBox() # Anything really, but it should be a widget (for if PyUseCase isn't installed)
def getTemplateFile(self): templateFile = os.path.join(self.location, "summary_template.html") if not os.path.isfile(templateFile): plugins.log.info("No file at '" + templateFile + "', copying default file from installation") includeSite, includePersonal = self.inputOptions.configPathOptions() srcFile = plugins.findDataPaths([ "summary_template.html" ], includeSite, includePersonal)[-1] shutil.copyfile(srcFile, templateFile) return templateFile
def __init__(self, *args): guiutils.SubGUI.__init__(self) # Do this first, so we set up interceptors and so on early on try: from storytext import createShortcutBar from version_control.custom_widgets_storytext import customEventTypes uiMapFiles = plugins.findDataPaths([ "*.uimap" ], *args) self.widget = createShortcutBar(uiMapFiles=uiMapFiles, customEventTypes=customEventTypes) self.widget.show() except ImportError: self.widget = None
def __init__(self, allApps, dynamic, uiManager, actionGUIs, menuNames, *args): guiutils.SubGUI.__init__(self) # Create GUI manager, and a few default action groups self.menuNames = menuNames self.dynamic = dynamic self.allFiles = plugins.findDataPaths([ "*.xml" ], *args) self.uiManager = uiManager self.actionGUIs = actionGUIs self.actionGroup = self.uiManager.get_action_groups()[0] self.toggleActions = [] self.loadedModules = self.getLoadedModules() self.diag = logging.getLogger("Menu Bar") self.diag.info("All description files : " + repr(self.allFiles))
def readGtkRCFiles(self, *args): for file in plugins.findDataPaths([ ".gtkrc-2.0" ], *args): gtk.rc_add_default_file(file)
def getInteractiveActionClasses(): classes = [ ShowMigrationNotes, ShowChangeLogs, ShowVersions, AboutTextTest ] for fileName in plugins.findDataPaths([ "*.txt" ], dataDirName="doc"): classes.append(plugins.Callable(TextFileDisplayDialog, os.path.basename(fileName))) return classes
wordNumber = -1 for index in range(len(words)): realWordNumber = -1 - index word = words[realWordNumber] if len(word): if wordNumber == self.wordNumber: return realWordNumber wordNumber -= 1 return len(words) + 1 if __name__ == "__main__": parser = OptionParser("usage: %prog [options] filter1 filter2 ...") parser.add_option("-m", "--module", help="also import module MODULE", metavar="MODULE") parser.add_option("-u", "--unordered", action="store_true", help='Use unordered filter instead of standard one') parser.add_option("-t", "--testrelpath", help="use test relative path RELPATH", metavar="RELPATH") (options, args) = parser.parse_args() if options.module: sys.modules["default.rundependent"] = sys.modules["__main__"] sys.path.insert(0, os.path.join(libDir, "../site/lib")) exec "import " + options.module allPaths = plugins.findDataPaths([ "logging.console" ], dataDirName="log", includePersonal=True) plugins.configureLogging(allPaths[-1]) # Won't have any effect if we've already got a log file if options.unordered: runDepFilter = UnorderedTextFilter(args, options.testrelpath) else: runDepFilter = RunDependentTextFilter(args, options.testrelpath) runDepFilter.filterFile(sys.stdin, sys.stdout)