Commit b7f06d4e authored by Ritesh Sarraf's avatar Ritesh Sarraf

Imported Upstream version 0.8

parent 1a19ae66
version: 0.8
Seascope is a GUI frontend for cscope, idutils.
* Running the application
......
......@@ -5,17 +5,18 @@
#
# License: BSD
import textwrap
from distutils.core import setup
setup(name='Seascope',
version='0.7',
description='A multi-platform multi-language source code browsing tool'
long_description='A pyQt GUI front-end for idutils, cscope and gtags. Written in python using pyQt, QScintilla libraries.',
version='0.8',
description='A multi-platform multi-language source code browsing tool',
long_description= textwrap.dedent("""A pyQt GUI front-end for idutils, cscope and gtags. Written in python using pyQt, QScintilla libraries."""),
url='http://seascope.googlecode.com',
packages=['Seascope',
'Seascope.backend',
'Seascope.backend.plugins',
'Seascope.backend.plugins.idutils'
'Seascope.backend.plugins.idutils',
'Seascope.backend.plugins.cscope',
'Seascope.backend.plugins.gtags',
'Seascope.view',
......@@ -25,7 +26,7 @@ setup(name='Seascope',
'Seascope.view.filecontext.plugins.generic_view',
],
package_dir={'Seascope': 'src'},
package_data={'Seascope': ['icons/*.svg','ui/*.ui','tools/*.py']},
package_data={'Seascope': ['icons/*.svg','tools/*.py', 'ui/*.ui', 'backend/plugins/*/ui/*.ui']},
license="BSD License",
classifiers=[
'Development Status :: 4 - Beta',
......
#!/usr/bin/python
if __name__ == '__main__':
import sys, os, optparse
usage = "usage: %prog filename"
op = optparse.OptionParser(usage=usage)
(options, args) = op.parse_args()
if len(args) != 1:
print >> sys.stderr, 'Please specify a filename'
sys.exit(-1)
filename = args[0]
filename = os.path.abspath(filename)
if not os.access(filename, os.R_OK):
print 'Failed to read the file:', filename
sys.exit(-2)
app_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(app_dir)
from PyQt4 import QtGui, QtCore
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from view import EdView, EdViewRW
import view
view.load_plugins()
app = QApplication(sys.argv)
w = QMainWindow()
if os.getenv("SEASCOPE_EDIT", 0):
book = EdViewRW.EditorBookRW()
else:
book = EdView.EditorBook()
actDescr = [
[ book.find_cb, 'Ctrl+F' ],
[ book.find_next_cb, 'F3' ],
[ book.find_prev_cb, 'Shift+F3' ],
]
for ad in actDescr:
act = QAction(w)
act.setShortcut(ad[1])
act.triggered.connect(ad[0])
w.addAction(act)
w.setCentralWidget(book)
w.resize(900, 600)
w.show()
book.show_file(filename)
w.setWindowTitle(filename)
sys.exit(app.exec_())
......@@ -18,7 +18,7 @@ except ImportError:
try:
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from view import EdView, EdViewRW, ResView, FileView, CallView, ClassGraphView, DebugView, CodemarkView
from view import EdView, EdViewRW, ResView, FileView, CallView, ClassGraphView, FileFuncGraphView, DebugView, CodemarkView, CodeContextView
import backend
from backend.plugins import PluginHelper
import DialogManager
......@@ -33,12 +33,13 @@ class SeascopeApp(QMainWindow):
ev_font = QFont()
ev_font.fromString(self.edit_book.ev_font)
res = DialogManager.show_preferences_dialog(self.app_style, self.edit_ext_cmd, ev_font, self.exit_dont_ask, self.inner_editing, self.eb_is_show_line)
(self.app_style, self.app_font, self.edit_ext_cmd, ev_font, self.exit_dont_ask, self.inner_editing, self.eb_is_show_line) = res
(self.app_style, self.app_font, self.edit_ext_cmd, ev_font, self.exit_dont_ask, self.inner_editing_conf, self.eb_is_show_line) = res
if self.edit_ext_cmd != None:
self.edit_ext_cmd = str(self.edit_ext_cmd).strip()
if (self.edit_ext_cmd == None or self.edit_ext_cmd == ''):
self.edit_ext_cmd = 'x-terminal-emulator -e vim %F +%L'
self.edit_book.change_ev_font(ev_font.toString())
self.code_ctx_view.change_ev_font(ev_font.toString())
self.edit_book.show_line_number_pref(self.eb_is_show_line)
self.app_write_config()
......@@ -63,10 +64,11 @@ class SeascopeApp(QMainWindow):
if not DialogManager.show_yes_no('Restart ?'):
return
hint = self.edit_book.get_file_line_list()
self.proj_close_cb()
if backend.proj_is_open():
self.proj_close_cb()
QApplication.quit()
os.environ['SEASCOPE_RESTART_HINT'] = '%s' % str(hint)
QProcess.startDetached(sys.executable, QApplication.arguments());
QProcess.startDetached(sys.executable, QApplication.arguments(), self.seascope_start_dir);
def file_restarted_cb(self):
try:
hint = os.environ['SEASCOPE_RESTART_HINT']
......@@ -281,7 +283,9 @@ class SeascopeApp(QMainWindow):
self.toolbar.addAction(si(QStyle.SP_MediaSkipBackward), 'Previous Position', self.go_prev_pos_cb)
self.toolbar.addAction(si(QStyle.SP_MediaSkipForward), 'Next Position', self.go_next_pos_cb)
self.toolbar.addSeparator()
self.toolbar.addAction(QIcon('icons/codeview.png'), 'Code Quick View', self.is_code_quick_view)
self.code_ctx_view_act = self.toolbar.addAction(QIcon('icons/codeview.png'), 'Code Quick View', self.code_ctx_view_act_cb)
self.code_ctx_view_act.setCheckable(True)
self.code_ctx_view_act.setChecked(self.is_show_code_ctx_view)
# app config
......@@ -298,6 +302,7 @@ class SeascopeApp(QMainWindow):
self.inner_editing_conf = False
self.inner_editing = False
self.is_show_toolbar = False
self.is_show_code_ctx_view = False
self.edit_ext_cmd = 'x-terminal-emulator -e vim %F +%L'
self.eb_is_show_line = False
......@@ -417,6 +422,7 @@ class SeascopeApp(QMainWindow):
self.res_book.clear()
self.file_view.clear()
self.cm_mgr.clear()
self.code_ctx_view.clear()
def proj_settings_cb(self):
backend.proj_settings_trigger()
......@@ -449,13 +455,17 @@ class SeascopeApp(QMainWindow):
def show_toolbar_cb(self):
self.is_show_toolbar = self.show_toolbar.isChecked()
if (self.is_show_toolbar):
if self.is_show_toolbar:
self.create_toolbar()
else:
self.removeToolBar(self.toolbar)
def is_code_quick_view(self):
QMessageBox.information(None, "Seascope", 'Not implemented yet!', QMessageBox.Ok)
def code_ctx_view_act_cb(self):
self.is_show_code_ctx_view = self.code_ctx_view_act.isChecked()
if self.is_show_code_ctx_view:
self.code_ctx_view.show()
else:
self.code_ctx_view.hide()
def connect_signals(self):
self.edit_book.sig_history_update.connect(self.res_book.history_update)
......@@ -464,6 +474,25 @@ class SeascopeApp(QMainWindow):
self.file_view.sig_show_file.connect(self.edit_book.show_file)
self.edit_book.sig_open_dir_view.connect(self.file_view.open_dir_view)
self.edit_book.sig_file_closed.connect(self.codemark_del_file_cb)
self.edit_book.sig_editor_text_selected.connect(self.editor_text_selected)
self.code_ctx_view.sig_codecontext_showfile.connect(self.code_context_showfile_cb)
def editor_text_selected(self, text):
if self.is_show_code_ctx_view:
if not self.code_ctx_view.set_cur_query(text):
return
rquery = {}
rquery['cmd'] = 'DEF'
rquery['req'] = str(text)
rquery['opt'] = None
sig_res = backend.prj.qry.query(rquery)
sig_res[0].connect(self.code_ctx_view_query_res_cb)
def code_ctx_view_query_res_cb(self, sym, res):
self.code_ctx_view.showResult(sym, res)
def code_context_showfile_cb(self, filename, line):
self.show_file_line(filename, line)
def setup_widget_tree(self):
self.hsp = QSplitter();
......@@ -475,8 +504,14 @@ class SeascopeApp(QMainWindow):
self.vsp.setOrientation(Qt.Vertical)
self.vsp.addWidget(self.hsp)
self.vsp.addWidget(self.res_book)
self.vsp.setSizes([1, 1])
self.hsp_res = QSplitter();
self.hsp_res.addWidget(self.res_book)
self.hsp_res.addWidget(self.code_ctx_view)
self.vsp.addWidget(self.hsp_res)
self.hsp_res.setSizes([200, 1])
self.vsp.setSizes([1, 60])
self.setCentralWidget(self.vsp)
self.setWindowTitle('Seascope')
self.setGeometry(300, 100, 800, 600)
......@@ -488,7 +523,8 @@ class SeascopeApp(QMainWindow):
self.edit_book.is_show_line = self.eb_is_show_line
self.edit_book.m_show_line_num.setChecked(self.edit_book.is_show_line)
if (self.ev_font):
self.edit_book.ev_font = self.ev_font
self.edit_book.ev_font = self.ev_font
self.code_ctx_view.ev_font = self.ev_font
self.show_toolbar.setChecked(self.is_show_toolbar)
def create_widgets(self):
......@@ -500,6 +536,8 @@ class SeascopeApp(QMainWindow):
self.res_book = ResView.ResultManager()
self.file_view = FileView.FileTree()
self.cm_mgr = CodemarkView.CodemarkManager()
self.code_ctx_view = CodeContextView.CodeContextViewManager()
self.code_ctx_view.hide()
self.sbar = self.statusBar()
self.create_mbar()
......@@ -515,12 +553,14 @@ class SeascopeApp(QMainWindow):
CallView.CallTreeWindow.parent = self
ClassGraphView.ClassGraphWindow.parent = self
FileFuncGraphView.FileFuncGraphWindow.parent = self
PluginHelper.backend_menu = self.backend_menu
PluginHelper.edit_book = self.edit_book
PluginHelper.res_book = self.res_book
PluginHelper.call_view = CallView
PluginHelper.class_graph_view = ClassGraphView
PluginHelper.file_func_graph_view = FileFuncGraphView
PluginHelper.file_view = self.file_view
PluginHelper.dbg_view = DebugView
......@@ -532,8 +572,9 @@ class SeascopeApp(QMainWindow):
font.fromString(self.app_font)
QApplication.setFont(font)
def __init__(self, parent=None):
def __init__(self, parent=None, app_start_dir=None):
QMainWindow.__init__(self)
self.seascope_start_dir = app_start_dir
self.app_read_config()
......@@ -543,8 +584,19 @@ class SeascopeApp(QMainWindow):
self.setup_widget_tree()
self.setup_style_and_font()
if len(self.recent_projects):
self.proj_open(self.recent_projects[0])
prj_path = None
args = QApplication.arguments()
if len(args) == 2:
prj_path = str(args[1])
if not os.path.isabs(prj_path):
dname = self.seascope_start_dir
prj_path = os.path.join(dname, prj_path)
if not prj_path or os.getenv('SEASCOPE_RESTART_HINT'):
if len(self.recent_projects):
prj_path = self.recent_projects[0]
if prj_path:
self.proj_open(prj_path)
#else:
#self.proj_open_cb()
self.file_restarted_cb()
......@@ -558,14 +610,17 @@ if __name__ == "__main__":
sys.exit(-1)
# change working dir to the script dir so that we can run this script anywhere else
app_start_dir = os.getcwd()
app_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(app_dir)
# load plugins
backend.load_plugins()
view.load_plugins()
# start app
app = QApplication(sys.argv)
ma = SeascopeApp()
ma = SeascopeApp(app_start_dir=app_start_dir)
ma.show()
ret = app.exec_()
sys.exit(ret)
......@@ -5,7 +5,7 @@
from PyQt4.QtCore import *
from datetime import datetime
import re
import os, re, subprocess
#class CtagsInfo:
#def __init__(self):
......@@ -104,23 +104,60 @@ class CtagsThread(QThread):
x = x - 1
while y < len(ct) - 1 and ct[y + 1][1] == n:
y = y + 1
if x < y:
for m in range(x, y + 1):
if re.match(self.sig.sym, ct[m][0]):
break
if x > y:
return False
for m in range(x, y + 1):
reqPat = self.sig.sym + '$'
if re.match(reqPat, ct[m][0]):
line[0] = ct[m][0]
return True
return False
else:
if self.cmd_str == 'DEF':
return False
if self.cmd_str == '-->':
if f.endswith('.tac'):
if ct[m][2] in ['reactor']:
line[0] = ct[m][0].split('=>')[0].strip() + "Is"
return True
line[0] = ct[m][0]
return True
def runCtagsCustom(self, fl):
custom_map = os.getenv('SEASCOPE_CTAGS_SUFFIX_CMD_MAP')
if not custom_map:
return []
try:
custom_map = eval(custom_map)
except:
print 'SEASCOPE_CTAGS_SUFFIX_CMD_MAP has errors'
return []
cmd_list = []
for (suffix, cmd) in custom_map:
_fl = [ f for f in fl if f.endswith(suffix) ]
args = cmd.split()
args += _fl
cmd_list.append(args)
if not len(cmd_list):
return []
out_data_all = []
for args in cmd_list:
proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
(out_data, err_data) = proc.communicate('\n'.join(fl))
out_data = re.split('\r?\n', out_data)
out_data_all += out_data
return out_data_all
def _run_ctags(self):
cmd = 'ctags -n -u --fields=+K -L - -f -'
args = cmd.split()
import subprocess
proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
(out_data, err_data) = proc.communicate('\n'.join(self.file_list))
out_data = re.split('\r?\n', out_data)
out_data += self.runCtagsCustom(self.file_list)
for line in out_data:
if line == '':
......@@ -181,7 +218,8 @@ class CtagsThread(QThread):
if self.cmd_str == 'DEF':
import_re = re.compile('^\s*import\s+')
for line in res:
if not re.match(req, line[0]):
reqPat = req + '$'
if not re.match(reqPat, line[0]):
continue
if import_re.search(line[3]) and line[1].endswith('.py'):
continue
......@@ -190,24 +228,36 @@ class CtagsThread(QThread):
if self.cmd_str == '-->':
call_re = re.compile('\\b%s\\b\s*\(' % req)
extern_re = re.compile('^\s*extern\s+')
reactor_re = re.compile('\\b(\w+::)*(\w+)\s*=>.*\\b%s\\b' % req)
comment_re = re.compile('^\s*(\*\s|/\*|\*/|//\s|# )')
func_ptr_re = re.compile('\\b(\w+)\s*(=|:)\s*%s\s*[,;:)]' % req)
func_as_arg_re = re.compile('(^\s*|[(,]\s*)(\w+(\.|->))*%s\s*[,)]' % req);
for line in res:
def _check_line():
if line[1].endswith('.tac'):
if '=>' in line[3]:
grp = reactor_re.search(line[3])
if grp:
line[0] = grp.group(2) + "Is"
return True
# fallthru
if line[0] == req:
if not re.search('(\.|->)%s\\b' % req, line[3]):
continue
elif call_re.search(line[3]):
return False
return True
if call_re.search(line[3]):
if extern_re.search(line[3]):
continue
else:
grp = func_ptr_re.search(line[3])
if grp:
line[0] = grp.group(1)
else:
if not func_as_arg_re.search(line[3]):
continue
return False
return True
grp = func_ptr_re.search(line[3])
if grp:
line[0] = grp.group(1)
return True
if not func_as_arg_re.search(line[3]):
False
return True
for line in res:
if not _check_line():
continue
if line[0] == '<unknown>':
continue
if comment_re.search(line[3]):
......
......@@ -43,6 +43,9 @@ class ProjectBase(QObject):
msg_box('%s: %s: Not implemeted' % (__name__, __func__))
class ConfigBase(QObject):
def __init__(self, ptype):
self.prj_type = ptype
@staticmethod
def prepare_menu(menubar):
pass
......@@ -91,7 +94,17 @@ class QueryUiBase(QObject):
PluginHelper.call_view_page_new(req, self.query.query, self.ctree_args, opt)
def query_class_graph(self, req, opt):
PluginHelper.class_graph_view_page_new(req, self.query.conf.id_dir, self.query.query, self.clgraph_args, opt)
(prj_dir, dummy1, dummy2) = self.query.conf.get_proj_conf()
prj_type = self.query.conf.prj_type
PluginHelper.class_graph_view_page_new(req, prj_dir, prj_type, self.query.query, opt)
def query_class_graph_dir(self, dname):
opt = []
PluginHelper.class_graph_view_page_new('', dname, None, self.query.query, opt)
def query_file_func_graph(self, fname):
opt = []
PluginHelper.file_func_graph_view_page_new('', fname, '', self.query.query, opt)
def _prepare_rquery(self, cmd_str, req, opt):
rquery = {}
......@@ -262,7 +275,8 @@ class PluginProcess(QObject):
self.sig.sig_result_dbg.emit(self.p_cmd, res, self.err_str)
try:
res = self.parse_result(res, self.sig)
except:
except Exception as e:
print e
res = [['', '', '', 'error while parsing output of: ' + self.p_cmd]]
if res != None:
self.sig.emit_result(res)
......
......@@ -11,6 +11,7 @@ edit_book = None
res_book = None
call_view = None
class_graph_view = None
file_func_graph_view = None
file_view = None
dbg_view = None
......@@ -67,8 +68,21 @@ def call_view_page_new(req, query_func, ctree_query_args, opt):
hint_file = editor_current_file()
call_view.create_page(req, query_func, ctree_query_args, opt, hint_file)
def class_graph_view_page_new(req, proj_dir, query_func, clgraph_query_args, opt):
class_graph_view.create_page(req, proj_dir, query_func, clgraph_query_args, opt)
def class_graph_view_page_new(req, dname, prj_type, query_func, opt):
clgraph_query_args = [
['CLGRAPH', 'D', 'Derived classes' ],
['CLGRAPH', 'B', 'Base classes' ],
]
class_graph_view.create_page(req, dname, prj_type, query_func, clgraph_query_args, opt)
def file_func_graph_view_page_new(req, dname, proj_dir, query_func, opt):
ffgraph_query_args = [
['FFGRAPH', 'F', 'File functions graph'],
['FFGRAPH_E', 'F+E', 'File functions + external graph'],
['FFGRAPH_D', 'D', 'Directory functions graph'],
['FFGRAPH_DE', 'D+E', 'Directory functions + external graph']
]
file_func_graph_view.create_page(req, dname, proj_dir, query_func, ffgraph_query_args, opt)
def file_view_update(flist):
file_view.add_files(flist)
......@@ -16,7 +16,7 @@ from .. import PluginHelper
class ConfigCscope(ConfigBase):
def __init__(self):
ConfigBase.__init__(self)
ConfigBase.__init__(self, 'cscope')
self.cs_dir = ''
self.cs_opt = []
......
......@@ -23,13 +23,17 @@ cmd_table = [
[ ['<--', '2'], ['&Called Functions', 'Ctrl+2'], ['Functions called by' ] ],
[ ['-->', '3'], ['C&alling Functions', 'Ctrl+3'], ['Functions calling' ] ],
[ ['TXT', '4'], ['Find &Text', 'Ctrl+4'], ['Find text' ] ],
[ ['GRP', '5'], ['Find &Egrep', 'Ctrl+5'], ['Find egrep pattern' ] ],
[ ['GREP','5'], ['Find &Egrep', 'Ctrl+5'], ['Find egrep pattern' ] ],
[ ['FIL', '7'], ['Find &File', 'Ctrl+7'], ['Find files' ] ],
[ ['INC', '8'], ['&Including Files', 'Ctrl+8'], ['Find #including' ] ],
[ ['---', None], [None ] ],
[ ['QDEF', '11'], ['&Quick Definition', 'Ctrl+]'], [None ] ],
[ ['CTREE','12'], ['Call Tr&ee', 'Ctrl+\\'], ['Call tree' ] ],
[ ['---', None], [None ], ],
[ ['CLGRAPH', '13'], ['Class &Graph', 'Ctrl+:'], ['Class graph' ] ],
[ ['CLGRAPHD', '14'], ['Class Graph Dir', 'Ctrl+;'], ['Class graph dir' ] ],
[ ['FFGRAPH', '14'], ['File Func Graph', 'Ctrl+^'], ['File Func graph dir' ] ],
[ ['---', None], [None ], ],
[ ['UPD', '25'], ['Re&build Database', None ], [None ] ],
]
......@@ -126,6 +130,17 @@ class QueryUiCscope(QueryUiBase):
if (not self.query.cs_is_ready()):
show_msg_dialog('\nProject has no source files')
return
if cmd_str == 'CLGRAPHD':
f = PluginHelper.editor_current_file()
if f:
d = os.path.dirname(f)
self.query_class_graph_dir(d)
return
if cmd_str == 'FFGRAPH':
f = PluginHelper.editor_current_file()
if f:
self.query_file_func_graph(f)
return
req = PluginHelper.editor_current_word()
if (req != None):
req = str(req).strip()
......@@ -142,6 +157,8 @@ class QueryUiCscope(QueryUiBase):
self.query_qdef(req, opt)
elif cmd_str == 'CTREE':
self.query_ctree(req, opt)
elif cmd_str == 'CLGRAPH':
self.query_class_graph(req, opt)
else:
self.do_query(cmd_str, req, opt)
......
......@@ -16,7 +16,7 @@ from .. import PluginHelper
class ConfigGtags(ConfigBase):
def __init__(self):
ConfigBase.__init__(self)
ConfigBase.__init__(self, 'gtags')
self.gt_dir = ''
self.gt_opt = ''
......
......@@ -23,13 +23,17 @@ cmd_table = [
#[ ['<--', '2'], ['&Called Functions', 'Ctrl+2'], ['Functions called by' ] ],
[ ['-->', '-r'], ['C&alling Functions', 'Ctrl+3'], ['Functions calling' ] ],
#[ ['TXT', '4'], ['Find &Text', 'Ctrl+4'], ['Find text' ] ],
[ ['GRP', '-g'], ['Find &Egrep', 'Ctrl+5'], ['Find egrep pattern' ] ],
[ ['GREP','-g'], ['Find &Egrep', 'Ctrl+5'], ['Find egrep pattern' ] ],
[ ['FIL', '-P'], ['Find &File', 'Ctrl+7'], ['Find files' ] ],
[ ['INC', '-g'], ['&Include/Import', 'Ctrl+8'], ['Find include/import' ] ],
[ ['---', None], [None ] ],
[ ['QDEF', ''], ['&Quick Definition', 'Ctrl+]'], [None ] ],
[ ['CTREE','12'], ['Call Tr&ee', 'Ctrl+\\'], ['Call tree' ] ],
[ ['---', None], [None ], ],
[ ['CLGRAPH', '13'], ['Class &Graph', 'Ctrl+:'], ['Class graph' ] ],
[ ['CLGRAPHD', '14'], ['Class Graph Dir', 'Ctrl+;'], ['Class graph dir' ] ],
[ ['FFGRAPH', '14'], ['File Func Graph', 'Ctrl+^'], ['File Func graph dir' ] ],
[ ['---', None], [None ], ],
[ ['UPD', '25'], ['Re&build Database', None ], [None ] ],
]
......@@ -114,6 +118,17 @@ class QueryUiGtags(QueryUiBase):
if (not self.query.gt_is_ready()):
show_msg_dialog('\nProject has no source files')
return
if cmd_str == 'CLGRAPHD':
f = PluginHelper.editor_current_file()
if f:
d = os.path.dirname(f)
self.query_class_graph_dir(d)
return
if cmd_str == 'FFGRAPH':
f = PluginHelper.editor_current_file()
if f:
self.query_file_func_graph(f)
return
req = PluginHelper.editor_current_word()
if (req != None):
req = str(req).strip()
......@@ -130,6 +145,8 @@ class QueryUiGtags(QueryUiBase):
self.query_qdef(req, opt)
elif cmd_str == 'CTREE':
self.query_ctree(req, opt)
elif cmd_str == 'CLGRAPH':
self.query_class_graph(req, opt)
else:
self.do_query(cmd_str, req, opt)
......
......@@ -13,7 +13,7 @@ from IdutilsProjectUi import QueryUiIdutils
class ConfigIdutils(ConfigBase):
def __init__(self):
ConfigBase.__init__(self)
ConfigBase.__init__(self, 'idutils')
self.id_dir = ''
self.id_opt = ''
......@@ -157,12 +157,19 @@ class IdProcess(PluginProcess):
return res
res = []
for line in text:
if line == '':
continue
line = line.split(':', 2)
line = ['<unknown>', os.path.join(self.wdir, line[0]), line[1], line[2]]
res.append(line)
if self.cmd_str == 'GREP':
for line in text:
if line == '':
continue
line = ['<unknown>'] + line.split(':', 2)
res.append(line)
else:
for line in text:
if line == '':
continue
line = line.split(':', 2)
line = ['<unknown>', os.path.join(self.wdir, line[0]), line[1], line[2]]
res.append(line)
#t3 = datetime.now()
#print 'parse-loop', t3 - t2
......@@ -192,15 +199,23 @@ class QueryIdutils(QueryBase):
pargs = ['lid', '-R', 'grep']
if cmd_str == 'FIL':
pargs = ['fnid', '-S', 'newline']
elif cmd_str == 'TXT':
pargs += ['-l']
elif cmd_str == 'GREP':
pargs = ['grep', '-E', '-R', '-n', '-I']
#elif cmd_str == 'TXT':
#pargs += ['-l']
elif 'substring' in opt:
#req = '.*' + req + '.*'
#pargs += ' -s'
pass
elif cmd_str in ['-->', '<--']:
pargs += ['-l']
if cmd_str != 'FIL':
if 'ignorecase' in opt:
pargs += ['-i']
pargs += [ '--', req ]
if cmd_str == 'GREP':
pargs += [self.conf.id_dir]
qsig = IdProcess(self.conf.id_dir, [cmd_str, req]).run_query_process(pargs, req, rquery)
return qsig
......
......@@ -23,14 +23,16 @@ cmd_table = [
#[ ['<--', '2'], ['&Called Functions', 'Ctrl+2'], ['Functions called by' ] ],
[ ['-->', '3'], ['C&alling Functions', 'Ctrl+3'], ['Functions calling' ] ],
#[ ['TXT', '4'], ['Find &Text', 'Ctrl+4'], ['Find text' ] ],
#[ ['GRP', ''], ['Find &Egrep', 'Ctrl+5'], ['Find egrep pattern' ] ],
[ ['GREP',''], ['Find &Egrep', 'Ctrl+5'], ['Find egrep pattern' ] ],
[ ['FIL', ''], ['Find &File', 'Ctrl+7'], ['Find files' ] ],
[ ['INC', '8'], ['&Include/Import', 'Ctrl+8'], ['Find include/import' ] ],
[ ['---', None], [None ] ],
[ ['QDEF', ''], ['&Quick Definition', 'Ctrl+]'], [None ] ],
[ ['CTREE','12'], ['Call Tr&ee', 'Ctrl+\\'], ['Call tree' ] ],
[ ['---', None], [None ], ],
[ ['CLGRAPH', '13'], ['Class &Graph', 'Ctrl+:'], ['Class graph' ] ],
[ ['CLGRAPH', '13'], ['Class &Graph', 'Ctrl+:'], ['Class graph' ] ],
[ ['CLGRAPHD', '14'], ['Class Graph Dir', 'Ctrl+;'], ['Class graph dir' ] ],
[ ['FFGRAPH', '14'], ['File Func Graph', 'Ctrl+^'], ['File Func graph dir' ] ],
[ ['---', None], [None ], ],
[ ['UPD', '25'], ['Re&build Database', None ], [None ] ],
]
......@@ -60,7 +62,7 @@ clgraph_query_args = [
['CLGRAPH', 'D', 'Derived classes' ],
['CLGRAPH', 'B', 'Base classes' ],
]
class QueryDialog(QDialog):