def main(): if Opt.NoUpdate == False: update.update_mloxdata() if Opt.GUI == True: # run with gui from modules.gui import mlox_gui mlox_gui().start() #Running in command line mode logging.info("Version: %s\t\t\t\t %s " % (version.full_version(), _["Hello!"])) if Opt.FromFile: if len(args) == 0: print _["Error: -f specified, but no files on command line."] usage(2) # exits for fromfile in args: l = loadorder() l.read_from_file(fromfile) if Opt.Explain != None: print l.explain(Opt.Explain, Opt.BaseOnly) #Only expain for first input file sys.exit(0) if Opt.Quiet: l.update(StringIO.StringIO()) else: l.update() #We never actually write anything if reading from file(s) if not Opt.WarningsOnly: print "[Proposed] New Load Order:\n---------------" for p in l.get_new_order(): print p else: # run with command line arguments l = loadorder() if Opt.GetAll: l.get_data_files() else: l.get_active_plugins() if l.order == []: l.get_data_files() if Opt.Explain != None: print l.explain(Opt.Explain, Opt.BaseOnly) sys.exit(0) if Opt.Quiet: l.update(StringIO.StringIO()) else: l.update() if not Opt.WarningsOnly: if Opt.Update: print "[UPDATED] New Load Order:\n---------------" l.write_new_order() print "[LOAD ORDER UPDATED!]" else: print "[Proposed] New Load Order:\n---------------" for p in l.get_new_order(): print p
def command_line_mode(args): """Run in command line mode. This assumes log levels were properly set up beforehand""" logging.info("%s %s", version.full_version(), _["Hello!"]) if args.fromfile: for fromfile in args.fromfile: my_loadorder = loadorder() my_loadorder.read_from_file(fromfile) process_load_order(my_loadorder, args) else: my_loadorder = loadorder() if args.all: my_loadorder.get_data_files() else: my_loadorder.get_active_plugins() process_load_order(my_loadorder, args)
def analyze_loadorder(self, fromfile): #Clear all the outputs (except Dbg) self.New.truncate(0) self.Old.truncate(0) self.Stats.truncate(0) self.Msg.truncate(0) logging.info("Version: %s\t\t\t\t %s " % (version.full_version(), _["Hello!"])) self.lo = loadorder() if fromfile != None: self.lo.read_from_file(fromfile) else: self.lo.get_active_plugins() if self.lo.order == []: self.lo.get_data_files() progress = wx.ProgressDialog("Progress", "", 100, None, wx.PD_AUTO_HIDE|wx.PD_APP_MODAL|wx.PD_ELAPSED_TIME) self.lo.update(self.Msg,progress) progress.Destroy() for p in self.lo.get_original_order(): self.Old.write(p+'\n') for p in self.lo.get_new_order(): self.New.write(p+'\n') if self.lo.is_sorted: self.can_update = False #Go ahead and display everything if not self.can_update: self.btn_update.Disable() display_colored_text(self.Stats.getvalue(),self.txt_stats) display_colored_text(self.Msg.getvalue(),self.txt_msg) display_colored_text(self.New.getvalue(),self.txt_new) self.txt_cur.SetValue(self.Old.getvalue()) self.label_cur.SetLabel(self.lo.origin) self.cur_vbox.Layout()
def analyze_loadorder(self, fromfile): #Clear all the outputs (except Dbg) self.New.truncate(0) self.Old.truncate(0) self.Stats.truncate(0) self.Msg.truncate(0) gui_logger.info("Version: %s\t\t\t\t %s " % (version.full_version(), _["Hello!"])) self.lo = loadorder() if fromfile != None: self.lo.read_from_file(fromfile) else: self.lo.get_active_plugins() if self.lo.order == []: self.lo.get_data_files() progress = wx.ProgressDialog( "Progress", "", 100, None, wx.PD_AUTO_HIDE | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME) #print(self.lo.update()) print(self.lo.update(progress), file=self.Msg) progress.Destroy() for p in self.lo.get_original_order(): self.Old.write(p + '\n') for p in self.lo.get_new_order(): self.New.write(p + '\n') if self.lo.is_sorted: self.can_update = False #Go ahead and display everything self.display()
#Parser, ang pluggraph import modules.ruleParser as ruleParser import modules.pluggraph as pluggraph print "\x1b[0;30;41m" + "Testing parser on dirHandler plugins" + '\x1b[0m' graph = pluggraph.pluggraph() myParser = ruleParser.rule_parser(plugins,graph,"./test1.data/",sys.stdout,file_names) myParser.read_rules("./test1.data/mlox_base.txt") print graph.topo_sort() print "\x1b[0;30;41m" + "Testing filename version" + '\x1b[0m' (f_ver,d_ver) = ruleParser.get_version("BB_Clothiers_of_Vvardenfell_v1.1.esp","./test1.data/") print (f_ver,d_ver,"BB_Clothiers_of_Vvardenfell_v1.1.esp") #Load order from modules.loadOrder import loadorder print "\x1b[0;30;41m" + "Testing loadorder 1" + '\x1b[0m' l1 = loadorder() l1.datadir = fileFinder.caseless_dirlist("./test1.data/") l1.plugin_file = "./userfiles/abot.txt" l1.game_type = None l1.get_active_plugins() l1.update() print l1.listversions() print "\x1b[0;30;41m" + "Testing loadorder 2" + '\x1b[0m' l2 = loadorder() l2.datadir = fileFinder.caseless_dirlist("./test1.data/") l2.get_data_files() l2.update() print "\x1b[0;30;41m" + "Testing loadorder 3" + '\x1b[0m' l3 = loadorder() l3.read_from_file("./userfiles/abot.txt") l3.update()
elif opt in ("--base-only"): Opt.BaseOnly = True elif opt in ("-d", "--debug"): console_log_stream.setLevel(logging.DEBUG) elif opt in ("-e", "--explain"): Opt.Explain = arg Opt.Quiet = True console_log_stream.setLevel(logging.WARNING) elif opt in ("-f", "--fromfile"): Opt.FromFile = True elif opt in ("--gui"): Opt.GUI = True elif opt in ("-h", "--help"): usage(0) # exits elif opt in ("-l", "--listversions"): l = loadorder() l.get_data_files() print l.listversions() sys.exit(0) elif opt in ("-p", "--parsedebug"): logging.getLogger('mlox.parser').setLevel(logging.DEBUG) console_log_stream.setLevel(logging.DEBUG) elif opt in ("--profile"): Opt.Profile = True elif opt in ("-q", "--quiet"): Opt.Quiet = True console_log_stream.setLevel(logging.WARNING) elif opt in ("--translations"): # dump the translation dictionary print "Languages translations for: %s" % arg for k, v in (load_translations(arg).items()):
def __call__(self, parser, namespace, values, option_string=None): my_loadorder = loadorder() my_loadorder.get_data_files() print my_loadorder.listversions() sys.exit(0)