本文整理汇总了Python中psr.sys.Sys.dprint方法的典型用法代码示例。如果您正苦于以下问题:Python Sys.dprint方法的具体用法?Python Sys.dprint怎么用?Python Sys.dprint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类psr.sys.Sys
的用法示例。
在下文中一共展示了Sys.dprint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wait_childs
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def wait_childs(self):
""""""
for r in wait(self.readers):
try:
msg = r.recv()
except EOFError:
self.readers.remove(r)
else:
if len(msg)==3 and msg[self.K_TYPE] in self.TYPE_MSG :
cpid = self.getcpid(msg[self.K_ID])
if msg[self.K_TYPE] == self.MSG_INIT :
if hasattr(self.onstart_bind, '__call__'):
self.onstart_bind(msg[self.K_ID], cpid, msg[self.K_DATA])
elif msg[self.K_TYPE] == self.MSG_PRINT :
if Sys.g.DEBUG :
if not Sys.g.GUI :
for item in msg[self.K_DATA] :
Sys.echo(item[0], Sys.clzdic[item[1]], False, True)
Sys.dprint('')
#~ else :
Sys.wlog(msg[self.K_DATA])
elif msg[self.K_TYPE] == self.MSG_DATA :
if hasattr(self.onrun_bind, '__call__'):
self.onrun_bind(msg[self.K_ID], cpid, msg[self.K_DATA])
elif msg[self.K_TYPE] == self.MSG_END :
if hasattr(self.onend_bind, '__call__'):
self.onend_bind(msg[self.K_ID], cpid, msg[self.K_DATA])
示例2: needConfig
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def needConfig(self):
Sys.clear()
self.pheader()
Sys.echo(" " * 4 + "ImpraStorage has no configuration file !!", Sys.Clz.fgB1)
Sys.dprint()
Sys.echo(
" " * 8 + "# to create the config file you must use this command with appropriate values :", Sys.Clz.fgn7
)
Sys.echo(" " * 8 + "# type command help for details", Sys.Clz.fgn7)
Sys.echo(" " * 8 + conf.PRG_CLI_NAME + " ", Sys.Clz.fgB7, False)
Sys.echo("conf ", Sys.Clz.fgB3, False)
Sys.echo("-S ", Sys.Clz.fgB3, False)
Sys.echo("profileName ", Sys.Clz.fgB1, False)
Sys.echo("-N ", Sys.Clz.fgB3, False)
Sys.echo("yourName ", Sys.Clz.fgB1, False)
Sys.echo("-K -H ", Sys.Clz.fgB3, False)
Sys.echo("accountHost ", Sys.Clz.fgB1, False)
Sys.echo("-P ", Sys.Clz.fgB3, False)
Sys.echo("993 ", Sys.Clz.fgB1, False)
Sys.echo("-U ", Sys.Clz.fgB3, False)
Sys.echo("accountName ", Sys.Clz.fgB1, False)
Sys.echo("-X ", Sys.Clz.fgB3, False)
Sys.echo("accountPassword ", Sys.Clz.fgB1)
Sys.dprint()
Sys.exit(1)
示例3: print_options
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def print_options():
""""""
Sys.dprint('\n')
AbstractCli.printLineSep(Const.LINE_SEP_CHAR,Const.LINE_SEP_LEN)
Sys.echo(' MAIN OPTIONS :\n' , Sys.CLZ_HELP_CMD)
Sys.echo(' '*4+'-v'.ljust(13,' ')+', --version' , Sys.CLZ_HELP_ARG)
Sys.echo(' '*50+'display programm version' , Sys.CLZ_HELP_ARG_INFO)
Sys.echo(' '*4+'-d'.ljust(13,' ')+', --debug' , Sys.CLZ_HELP_ARG)
Sys.echo(' '*50+'enable debug mode' , Sys.CLZ_HELP_ARG_INFO)
Sys.echo(' '*4+'-f'.ljust(13,' ')+', --force' , Sys.CLZ_HELP_ARG)
Sys.echo(' '*50+'force rewriting existing files without alert' , Sys.CLZ_HELP_ARG_INFO)
Sys.echo(' '*4+'-q'.ljust(13,' ')+', --quiet' , Sys.CLZ_HELP_ARG)
Sys.echo(' '*50+'don\'t print status messages to stdout' , Sys.CLZ_HELP_ARG_INFO)
Sys.echo(' '*4+'-h'.ljust(13,' ')+', --help' , Sys.CLZ_HELP_ARG)
Sys.echo(' '*50+'display help' , Sys.CLZ_HELP_ARG_INFO)
Sys.dprint('\n')
Sys.echo(' KEY OPTIONS :\n' , Sys.CLZ_HELP_CMD)
Sys.echo(' '*4+'-a ' , Sys.CLZ_HELP_ARG, False)
Sys.echo('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
Sys.echo(', --bind_opt_a'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
Sys.echo('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
Sys.echo(' '*50+'description option a' , Sys.CLZ_HELP_ARG_INFO)
Sys.echo(' '*4+'-b ' , Sys.CLZ_HELP_ARG, False)
Sys.echo('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM, False)
Sys.echo(', --bind_opt_b'.ljust(18,' ') , Sys.CLZ_HELP_ARG, False)
Sys.echo('VALUE'.ljust(10,' ') , Sys.CLZ_HELP_PARAM)
Sys.echo(' '*50+'description option b' , Sys.CLZ_HELP_ARG_INFO)
示例4: add
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def add(self, key, label, count, ext='', usr='', cat='', fhash='', size=0, account=''):
"""Add an entry to the index
"""
if self.get(fhash) == None :
self.dic[fhash] = (self.id, fhash, label, size, count, ext, usr, cat, account, key)
self.id +=1
return self.id-1
else :
Sys.dprint(label+' already exist')
示例5: load_profile
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def load_profile(self):
""""""
if self.check_profile(self.o.active_profile):
Sys.dprint(" ", end=" ")
Sys.echo(" == profile `", Sys.Clz.bg2 + Sys.Clz.fgb7, False)
Sys.echo(self.o.active_profile, Sys.Clz.bg2 + Sys.Clz.fgB3, False)
Sys.echo("` loaded == ", Sys.Clz.bg2 + Sys.Clz.fgb7)
Sys.dprint()
self.ini.set("profile", self.o.active_profile)
self.ini.save()
else:
self.check_profile(self.o.active_profile, True)
示例6: remove
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def remove(self):
""""""
self._getId()
try:
if self.idx!= None : self.delids.append(Io.bytes(self.idx))
self.ih.delete(self.delids, True)
self.idx = None
except Exception as e :
Sys.dprint('error : ')
Sys.dprint(e)
self.ih.clearTrash()
self.removeLocal()
示例7: onCommandGet
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def onCommandGet(self):
""""""
if not len(self.a) > 1:
self.parser.error_cmd((self.a[0] + " command need an id",), True)
else:
vid = self.a[1]
ids = []
for sid in vid.split(","):
seq = sid.split("-")
if len(seq) == 2:
ids.extend(range(int(seq[0]), int(seq[1]) + 1))
else:
ids.append(sid)
for sid in ids:
Sys.clear()
self.pheader()
if self.impst.getFile(sid):
self.Cli.printLineSep(Const.LINE_SEP_CHAR, Const.LINE_SEP_LEN)
Sys.dprint(" ", end="")
Sys.echo(" == OK == ", Sys.Clz.bg2 + Sys.Clz.fgb7)
Sys.dprint()
else:
self.Cli.printLineSep(Const.LINE_SEP_CHAR, Const.LINE_SEP_LEN)
Sys.dprint(" ", end="")
Sys.echo(" == `", Sys.Clz.bg1 + Sys.Clz.fgB7, False)
Sys.echo(str(sid), Sys.Clz.bg1 + Sys.Clz.fgB3, False)
Sys.echo("` KO == ", Sys.Clz.bg1 + Sys.Clz.fgB7)
Sys.dprint()
示例8: update
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def update(self):
""""""
self.switchFileAccount(self.conf.profile)
try:
if self.idx != None :
if not isinstance(self.idx,bytes):
self.idx = Io.bytes(self.idx)
self.delids.append(self.idx)
except Exception as e :
Sys.dprint('error : ')
Sys.dprint(e)
self.index.fixDuplicateIds()
#~ self.index.fixAccount('gmail5')
self.index.encrypt()
msgIndex = self.mb.buildIndex(self.pathIdx)
_, self.idx = self.ih.send(msgIndex.as_string(), self.rootBox)
date = self.ih.headerField(self.idx, 'date', True)
self.conf.sets((['uid' , self.idx , 'index'],
['date' , date , 'index'],
['time' , str(Sys.datetime.now()), 'index']))
Sys.pwlog([(' Index updated (' , Const.CLZ_0),
(str(int(self.idx)) , Const.CLZ_2),
(') ' , Const.CLZ_0),
(str(date) , Const.CLZ_7, True)])
try :
self.ih.delete(self.delids, True)
except :
Sys.dprint('error : ')
Sys.dprint(e)
self.ih.clearTrash()
return True
示例9: on_progress
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def on_progress(self, thread=None, progress=None, ref=None):
#~ print('thread_progress', thread.name, progress)
while not Sys.g.LOG_QUEUE.empty():
cth, data = Sys.g.LOG_QUEUE.get()
#~ print('*'+str(cth))
if data is not None :
if data is Sys.g.SIGNAL_STOP :
Sys.dprint('STOP')
if thread is not None : thread.cancel()
elif data is Sys.g.SIGNAL_CLEAR :
self.clearLog(thname=cth)
else:
self.printTextView(data, thname=cth)
if progress is not None : self.update_progress(progress, thname=thread.name)
示例10: _write
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
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)
示例11: on_start
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def on_start(self):
""""""
self.app.createDefaultKeyIfNone()
key, size, mark = self.app.getKeyInfos()
self.curKey = self.DEFAULT_KEY
print('-'*15)
v = self.app.getDefaultKeyPath()
print(v)
self.get('filechooserbutton1').set_filename(self.app.getDefaultKeyPath())
print(conf.DEFVAL_USER_PATH)
self.get('filechooserbutton3').set_current_folder(conf.DEFVAL_USER_PATH)
devPath = '/home/dev/git_repos/kirmah2.15/'
#~ self.get('filechooserbutton3').set_current_folder(devPath)
self.get('checkbutton1').set_active(conf.DEFVAL_NPROC>=2)
self.get('checkbutton3').set_active(True)
self.get('checkbutton4').set_active(True)
self.get('spinbutton2').set_value(conf.DEFVAL_NPROC)
if conf.DEFVAL_NPROC >= 2:
self.disable('spinbutton2', False)
self.get('checkbutton2').set_active(conf.DEFVAL_MIXMODE)
self.get('checkbutton4').set_active(conf.DEFVAL_RANDOMMODE)
self.get('entry1').set_text(mark)
Sys.g.UI_AUTO_SCROLL = True
self.textview = self.get('textview1')
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'))
self.textbuffer = self.textview.get_buffer()
self.tags = self.buildTxtTags(self.textbuffer)
self.progressbar = self.get('progressbar1')
cbt = self.get('comboboxtext1')
cbt.connect("changed", self.on_compression_changed)
tree_iter = cbt.get_model().get_iter_first()
print(cbt.get_model().get_string_from_iter(tree_iter))
tree_iter = cbt.get_model().get_iter_from_string('3')
cbt.set_active_iter(tree_iter)
cbt = self.get('comboboxtext2')
cbt.connect("changed", self.on_logging_changed)
tree_iter = cbt.get_model().get_iter_first()
tree_iter = cbt.get_model().get_iter_from_string('4')
cbt.set_active_iter(tree_iter)
Sys.clear()
Sys.dprint('INIT UI')
self.start = True
self.thkmh = None
示例12: onCommandEdit
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def onCommandEdit(self):
""""""
key = self.getMatchKey()
if key is not None:
if self.o.label is not None or self.o.category is not None:
if self.impst.editFile(key, self.o.label, self.o.category):
Sys.clear()
self.pheader()
self.impst.idxu.index.print("ID", [int(self.a[1])])
Sys.dprint("\n ", end="")
Sys.echo(" == OK == ", Sys.Clz.bg2 + Sys.Clz.fgb7)
Sys.dprint()
else:
self.parser.error_cmd(
(("id ", (self.a[1], Sys.CLZ_ERROR_PARAM), " has not been modified "),), False
)
else:
self.parser.error_cmd(((" command edit need a label or a category "),), True)
示例13: onCommandExport
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def onCommandExport(self):
""""""
Sys.clear()
self.pheader()
from time import strftime
name = strftime("%Y%m%d%H%M%S") + "_" + self.impst.idxu.conf.profile
Sys.echo(" saving ", Sys.Clz.fgn7, False)
Sys.echo(name + ".index" + Kirmah.EXT, Sys.Clz.fgB2)
Io.copy(self.impst.idxu.pathIdx, name + ".index" + Kirmah.EXT)
Sys.echo(" saving ", Sys.Clz.fgn7, False)
Sys.echo(name + ".ini" + Kirmah.EXT, Sys.Clz.fgB2)
self.impst.idxu.conf.ini.save(name + ".ini", True)
Sys.echo(" saving ", Sys.Clz.fgn7, False)
Sys.echo(name + ".key", Sys.Clz.fgB2)
Io.set_data(name + ".key", self.impst.idxu.conf.get("key", "keys"))
Sys.dprint("\n ", end="")
Sys.echo(" == OK == ", Sys.Clz.bg2 + Sys.Clz.fgb7)
Sys.dprint()
示例14: printSection
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def printSection(self, sectionName, withoutSectionName=False):
""""""
if sectionName!='main':
Sys.dprint()
if not withoutSectionName :
Sys.echo('['+sectionName+']', Sys.Clz.fgB3)
else:
Sys.echo('['+sectionName.split('.')[1]+']', Sys.Clz.fgB3)
if sectionName in self.dic :
for k in sorted(self.dic[sectionName]):
k = k.rstrip(' ')
a = ''
Sys.echo(k.ljust(10,' ')+' = ' , Sys.Clz.fgn7, False)
if self.dic[sectionName][k] is not None :
if len(self.dic[sectionName][k]) > 98: a = '…'
if Sys.isUnix() or k is not 'key' :
Sys.echo(self.dic[sectionName][k][:98]+a, Sys.Clz.fgN2)
else:
Sys.echo('key is masked', Sys.Clz.fgb1)
示例15: thread_progress
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import dprint [as 别名]
def thread_progress(self, thread, progress, ref):
while not Sys.g.LOG_QUEUE.empty():
data = Sys.g.LOG_QUEUE.get()
if data is not None:
if data is not Sys.g.SIGNAL_STOP:
for item in data:
ei = self.textbuffer.get_end_iter()
offs = ei.get_offset()
self.textbuffer.insert_at_cursor(item[0])
ei = self.textbuffer.get_end_iter()
oi = self.textbuffer.get_iter_at_offset(offs)
tagName = item[1]
self.textbuffer.apply_tag(self.tags[tagName], oi, ei)
self.textbuffer.insert_at_cursor("\n")
self.scroll_end()
else:
Sys.dprint("STOP")
thread.cancel()
self.update_progress(progress)