Ejemplo n.º 1
0
	def compact_to_tab(self):
		plain_rpt	= get_str_report()
		if False:pass
		elif app_name=='CudaText':
			app.file_open('')
			ed.set_text_all(plain_rpt)
		elif app_name=='SynWrite':
			pass
Ejemplo n.º 2
0
	def compact_to_tab(self):
		if app_name=='CudaText' and app.app_api_version()<'1.0.212':     # depr PROC_GET_COMMAND, PROC_GET_COMMAND_PLUGIN
			app.msg_box('Plugin needs newer app version', app.MB_OK)
			return
		plain_rpt	= get_str_report()
		if False:pass
		elif app_name=='CudaText':
			app.file_open('')
			ed.set_text_all(plain_rpt)
		elif app_name=='SynWrite':
			pass
Ejemplo n.º 3
0
 def save_and_open(path):
     fvdata['fv_tab']    = tabs
     fvdata['fv_files']  = files
     fvdata['fv_projs']  = projs
     fvdata['fv_fold' ]  = fold 
     fvdata['fv_last' ]  = last 
     save_fav_data(fvdata)
     if os.path.isdir( path):
         path= app.dlg_file(True, '', path, '')
         if not path:    return False
     app.file_open(path)
     return True
Ejemplo n.º 4
0
    def do_rprt(self, aid, ag):
        m,M         = self,CfgKeysDlg
        if False:pass
        elif aid=='trpt':
            # Compact report to tab
            app.file_open('')
            ed.set_text_all(get_str_report())

        elif aid=='hrpt':
            # Full report to HTML
            htm_file = os.path.join(tempfile.gettempdir(), '{}_keymapping.html'.format(app_name))
            do_report(htm_file)
            webbrowser.open_new_tab('file://'+htm_file)
            app.msg_status(_('Opened browser with file ')+htm_file)
        return []
Ejemplo n.º 5
0
 def do_code(self, aid, ag):
     m,M         = self,CfgKeysDlg
     
     lwks_n  = ag.cval('lwks')
     if lwks_n==-1:                      return [] #continue#while
     m.cmd_id  = m.fl_Is[lwks_n]
     pass;                  #LOG and log('m.fl_Is={}',(m.fl_Is))
     pass;                  #LOG and log('lwks_n,m.cmd_id={}',(lwks_n,m.cmd_id))
     if False:pass
     elif aid=='cpnm':
         cmd_nkk = m.id2nkks[m.cmd_id]
         app.app_proc(app.PROC_SET_CLIP, cmd_nkk[0])
     
     elif aid=='open':
         pass;               LOG and log('m.cmd_id={}',(m.cmd_id))
         if type(m.cmd_id)!=str:         return [] #continue#while
         plug_mdl,   \
         plug_mth    = m.cmd_id.split(',')[0:2]
         plug_mth    = 'def '+ plug_mth + '(self):'
         plug_dir    = app.app_path(app.APP_DIR_PY)+os.sep+plug_mdl
         plug_py     = plug_dir+os.sep+'__init__.py'
         plug_body   = open(plug_py, encoding='UTF-8').read()
         pass;               LOG and log('plug_mdl,plug_mth,plug_dir,plug_py={}',(plug_mdl,plug_mth,plug_dir,plug_py))
         mch         = re.search(r'from\s+\.(\w+)\s+import\s+Command', plug_body)
         if mch:
             # from .other_py import Command
             plug_py = plug_dir+os.sep+mch.group(1)+'.py'
             pass;           LOG and log('plug_py={}',(plug_py))
             plug_body=open(plug_py, encoding='UTF-8').read()
         if plug_mth not in plug_body:   return [] #continue#while
         # Open
         app.file_open(plug_py)
         # Locate
         user_opt= app.app_proc(app.PROC_GET_FINDER_PROP, '') \
                     if app.app_api_version()>='1.0.248' else \
                   app.app_proc(app.PROC_GET_FIND_OPTIONS, '')   # Deprecated
         ed.cmd(cmds.cmd_FinderAction, chr(1).join([]
             +['findnext']
             +[plug_mth]
             +['']
             +['fa']
         ))
         if app.app_api_version()>='1.0.248':
             app.app_proc(app.PROC_SET_FINDER_PROP, user_opt)
         else:
             app.app_proc(app.PROC_SET_FIND_OPTIONS, user_opt)   # Deprecated
         return None #break#while
     return []
Ejemplo n.º 6
0
def _file_open(op_file):
    if not app.file_open(op_file):
        return None
    for h in app.ed_handles(): 
        op_ed   = app.Editor(h)
        if os.path.samefile(op_file, op_ed.get_filename()):
            return op_ed
    return None
 def config(self):
   do_save_ops()
   if os.path.isfile(fn_ini):
     app.file_open(fn_ini)
   else:
     app.msg_status('Config file not found')