示例#1
0
文件: ui.py 项目: necrose99/Kirmah
 def run(self):
     """"""
     self.cancelled = False
     Sys.g.MPEVENT.clear()
     print(Sys.g.LOG_LEVEL)
     Cli("./", Sys.getpid(), self.cliargs, self, Sys.g.LOG_LEVEL)
     self.emit("completed")
示例#2
0
 def run(self):
     """"""
     self.cancelled = False
     Sys.g.MPEVENT.clear()
     print(Sys.g.LOG_LEVEL)
     Cli('./', Sys.getpid(), self.cliargs, self, Sys.g.LOG_LEVEL)
     self.emit("completed")
示例#3
0
    def _write(sign, t=None, enter=True, args=''):
        """"""
        if Sys.g.DEBUG :
            #~ DONT USE Sys.g.RLOCK
            isChildProc = not Sys.g_is_main_proc()
            bind_data   = []
            if t is not None :
                bind_data += Sys.pdate(t.timetuple() if enter else Sys.datetime.now().timetuple(), isChildProc)

            a, b, c, d, e = ('=> ' if enter else '<= '), '['+str(Sys.getpid()).rjust(5,' ')+']', ' '+sign+'(', Log._formatArgs(args), ') '
            if not isChildProc :
                Sys.echo(a , Sys.CLZ_IO  , False)
                Sys.echo(b , Sys.CLZ_PID if  not isChildProc else Sys.CLZ_CPID, False)
                Sys.echo(c , Sys.CLZ_FUNC, False)
                try:
                    Sys.echo(d , Sys.CLZ_ARGS, False)
                except :
                    Sys.echo('?nr_arg?' , Sys.CLZ_ARGS, False)
                    pass
                Sys.echo(e , Sys.CLZ_FUNC, False)

            bind_data += [(a, Const.CLZ_IO),(b, Const.CLZ_CPID if isChildProc else Const.CLZ_PID),(c , Const.CLZ_CFUNC if isChildProc else Const.CLZ_FUNC),(d , Const.CLZ_ARGS),(e , Const.CLZ_CFUNC if isChildProc else Const.CLZ_FUNC)]

            if not enter and t is not None :
                bind_data += Sys.pdelta(t, '', isChildProc)
            else :
                bind_data += Sys.dprint(dbcall=isChildProc)

            if isChildProc :
                Sys.sendMainProcMsg(1, bind_data)
            else :
                Sys.wlog(bind_data)
示例#4
0
 def on_start(self):
     """"""
     Sys.g.GUI_PRINT_STDOUT = False
     Sys.g.GUI              = True
     init(conf.PRG_NAME, False, Sys.getpid(), True, Const.LOG_ALL)
     self.conf        = ImpraConf(KiniFile('impra2.ini'))
     self.populate_profiles()
     self.populate_config()
     self.taskLabel     = ImpraThread.TASK_LABEL
     self.taskStock     = ImpraThread.TASK_STOCK
     self.progressbar   = self.get('progressbar1')
     self.textview      = self.get('textview1')
     try :
         self.textview.override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(0, 0, 0, 1.0))
         self.textview.modify_font(Pango.font_description_from_string ('DejaVu Sans Mono Book 11' if Sys.isUnix() else 'Lucida Conosle 11'))
     except :
         pass
     self.textbuffer    = self.textview.get_buffer()
     self.tags          = self.buildTxtTags(self.textbuffer)
     self.initWidgetByThread('impra-1', self.textview, self.textbuffer, self.progressbar, self.tags)
     self.initWidgetByThread('MainThread', self.textview, self.textbuffer, self.progressbar, self.tags)
     self.tree          = self.get('treeview1')
     self.tree.connect('row-activated', self.on_row_select)
     self.tree.get_selection().connect('changed', self.on_tree_selection_changed)
     self.launch_thread(self.on_ended)
     
     self.searchCatg    = self.get('comboboxtext1')
     self.searchUser    = self.get('comboboxtext4')
     self.searchAccount = self.get('comboboxtext5')
     self.filterIds     = None
     self.index         = None
     self.taskList      = {}
     self.threads_work  = [False, False]
示例#5
0
 def __init__(self, debug=False, color=True, loglvl=Const.LOG_NEVER):
     """"""
     self.encmode         = conf.DEFVAL_ENCMODE
     self.splitmode       = False
     self.compression     = conf.DEFVAL_COMP
     self.mix             = conf.DEFVAL_MIXMODE
     self.random          = conf.DEFVAL_RANDOMMODE
     self.nproc           = conf.DEFVAL_NPROC
     self.src             = None
     self.dst             = None
     self.kpath           = None
     Sys.g.GUI            = True
     init(conf.PRG_NAME, debug, Sys.getpid(), color, loglvl)
示例#6
0
 def __init__(self, debug=True, color=True, loglvl=Const.LOG_DEFAULT):
     """"""
     self.encmode         = conf.DEFVAL_ENCMODE
     self.splitmode       = False
     self.compression     = conf.DEFVAL_COMP
     self.mix             = conf.DEFVAL_MIXMODE
     self.random          = conf.DEFVAL_RANDOMMODE
     self.nproc           = conf.DEFVAL_NPROC
     self.src             = None
     self.dst             = None
     self.kpath           = None
     Sys.g.GUI            = True
     init(conf.PRG_NAME, debug, Sys.getpid(), color, loglvl)
示例#7
0
 def __init__(self, task, nproc=2, delay=None, event=None, *args, **kwargs):
     """"""
     self.readers = []
     self.plist   = []
     self.onstart_bind = None
     self.onrun_bind   = None
     self.onend_bind   = None
     for id in range(nproc):
         r, w = Pipe(duplex=False)
         self.readers.append(r)
         # (process, wpipe)
         p = Process(target=Worker, args=tuple([Sys.g.PRJ_NAME, Sys.g.DEBUG, Sys.g.GUI, Sys.g.COLOR_MODE, Sys.g.LOG_LEVEL, Sys.getpid(), event, id, w, delay, task])+tuple(args), kwargs=kwargs)
         self.plist.append((p, w))