Beispiel #1
0
    def refreshCtrl(self):
        ListCtrlView.refreshCtrl(self)
        i = 0
        modSort = self.model.modules.keys()
        modSort.sort()
        for mod in modSort:
            # XXX Show a broken icon as default
            imgIdx = -1
            modTpe = "Unknown"
            if self.model.moduleModels.has_key(mod):
                imgIdx = self.model.moduleModels[mod].imgIdx
                modTpe = self.model.moduleModels[mod].modelIdentifier
            else:
                self.model.idModel(mod)
                if self.model.moduleModels.has_key(mod):
                    imgIdx = self.model.moduleModels[mod].imgIdx
                    modTpe = self.model.moduleModels[mod].modelIdentifier

            appMod = self.model.modules[mod]

            if appMod[0]:
                modTpe = "*%s*" % modTpe

            i = self.addReportItems(i, (mod, modTpe, appMod[1], appMod[2]), imgIdx)

        self.pastelise()
Beispiel #2
0
    def __init__(self, parent, model):
        ListCtrlView.__init__(self, parent, model, wx.LC_REPORT, (
            (_('Open'), self.OnOpen, self.openBmp, ''),
            ('-', None, '', ''),
            (_('Add'), self.OnAdd, self.addModBmp, 'Insert'),
            (_('Edit'), self.OnEdit, '-', ''),
            (_('Remove'), self.OnRemove, self.remModBmp, 'Delete'),
            ('-', None, '', ''),
            (_('Find'), self.OnFind, self.findBmp, 'Find'),
            ('-', None, '-', ''),
            (_('Make module main module'), self.OnMakeMain, '-', ''),
        ), 0)

        self.InsertColumn(0, _('Module'), width=150)
        self.InsertColumn(1, _('Type'), width=50)
        self.InsertColumn(2, _('Description'), width=150)
        self.InsertColumn(3, _('Relative path'), width=220)

        self.sortOnColumns = [0, 1, 3]

        self.SetImageList(model.editor.modelImageList, wx.IMAGE_LIST_SMALL)

        self.lastSearchPattern = ''
        self.active = True
        self.canExplore = True
        self.model = model
Beispiel #3
0
    def __init__(self, parent, model):
        ListCtrlView.__init__(
            self,
            parent,
            model,
            wx.LC_REPORT,
            (
                (_("Open"), self.OnOpen, self.openBmp, ""),
                ("-", None, "", ""),
                (_("Add"), self.OnAdd, self.addModBmp, "Insert"),
                (_("Edit"), self.OnEdit, "-", ""),
                (_("Remove"), self.OnRemove, self.remModBmp, "Delete"),
                ("-", None, "", ""),
                (_("Find"), self.OnFind, self.findBmp, "Find"),
                ("-", None, "-", ""),
                (_("Make module main module"), self.OnMakeMain, "-", ""),
            ),
            0,
        )

        self.InsertColumn(0, _("Module"), width=150)
        self.InsertColumn(1, _("Type"), width=50)
        self.InsertColumn(2, _("Description"), width=150)
        self.InsertColumn(3, _("Relative path"), width=220)

        self.sortOnColumns = [0, 1, 3]

        self.SetImageList(model.editor.modelImageList, wx.IMAGE_LIST_SMALL)

        self.lastSearchPattern = ""
        self.active = True
        self.canExplore = True
        self.model = model
Beispiel #4
0
    def refreshCtrl(self):
        ListCtrlView.refreshCtrl(self)
        i = 0
        modSort = self.model.modules.keys()
        modSort.sort()
        for mod in modSort:
            # XXX Show a broken icon as default
            imgIdx = -1
            modTpe = 'Unknown'
            if self.model.moduleModels.has_key(mod):
                imgIdx = self.model.moduleModels[mod].imgIdx
                modTpe = self.model.moduleModels[mod].modelIdentifier
            else:
                self.model.idModel(mod)
                if self.model.moduleModels.has_key(mod):
                    imgIdx = self.model.moduleModels[mod].imgIdx
                    modTpe = self.model.moduleModels[mod].modelIdentifier

            appMod = self.model.modules[mod]

            if appMod[0]:
                modTpe = '*%s*' % modTpe

            i = self.addReportItems(i, (mod, modTpe, appMod[1], appMod[2]),
                                    imgIdx)

        self.pastelise()
Beispiel #5
0
    def __init__(self, parent, model):
        ListCtrlView.__init__(self, parent, model, wx.LC_REPORT,
          ((_('Open'), self.OnOpen, self.openBmp, ''),
           ('-', None, '', ''),
           (_('Add'), self.OnAdd, self.addModBmp, 'Insert'),
           (_('Edit'), self.OnEdit, '-', ''),
           (_('Remove'), self.OnRemove, self.remModBmp, 'Delete'),
           ('-', None, '', ''),
           (_('Find'), self.OnFind, self.findBmp, 'Find'),
           ('-', None, '-', ''),
           (_('Make module main module'), self.OnMakeMain, '-', ''),
           ), 0)

        self.InsertColumn(0, _('Module'), width = 150)
        self.InsertColumn(1, _('Type'), width = 50)
        self.InsertColumn(2, _('Description'), width = 150)
        self.InsertColumn(3, _('Relative path'), width = 220)

        self.sortOnColumns = [0, 1, 3]

        self.SetImageList(model.editor.modelImageList, wx.IMAGE_LIST_SMALL)

        self.lastSearchPattern = ''
        self.active = True
        self.canExplore = True
        self.model = model
Beispiel #6
0
    def refreshCtrl(self):
        ListCtrlView.refreshCtrl(self)
        i = 0
        self.listResultIdxs = []
        for mod in self.results.keys():
            for result in self.results[mod]:
                self.listResultIdxs.append((mod, result))
                i = self.addReportItems(i, (os.path.basename(mod), ` result[0] `, ` result[1] `, result[2].strip()))

        self.model.editor.statusBar.setHint(_('%d matches of "%s".') % (i, self.findPattern))

        self.pastelise()
Beispiel #7
0
 def refreshCtrl(self):
     ListCtrlView.refreshCtrl(self)
     if self.stats:
         self.statKeyList = self.stats.keys()
         self.statKeyList.sort()
         i = 0
         for filename, lineno, funcname in self.statKeyList:
             stats = self.stats[(filename, lineno, funcname)]
             i = self.addReportItems(i, (os.path.basename(filename), str(lineno),
                   funcname, '%d' % stats[0], '%f' % stats[2],
                   stats[0] and '%f' % (stats[2]/stats[0]) or '',
                   '%f' % stats[3],
                   stats[0] and '%f' % (stats[3]/stats[0]) or ''))
             self.SetItemData(i-1, i-1)
     self.pastelise()
Beispiel #8
0
    def __init__(self, parent, model):
        ListCtrlView.__init__(self, parent, model, wx.LC_REPORT,
          ((_('Goto file'), self.OnGoto, self.gotoLineBmp, ''),), 0)

        self.sortOnColumns = [0, 1]

        self.InsertColumn(0, _('Name'))
        self.InsertColumn(1, _('#Todos'))
        self.InsertColumn(2, _('Filepath'))
        self.SetColumnWidth(0, 75)
        self.SetColumnWidth(1, 25)
        self.SetColumnWidth(2, 350)

        self.todos = []
        self.active = True
Beispiel #9
0
    def refreshCtrl(self):
        ListCtrlView.refreshCtrl(self)
        i = 0
        self.listResultIdxs = []
        for mod in self.results.keys():
            for result in self.results[mod]:
                self.listResultIdxs.append((mod, result))
                i = self.addReportItems(i,
                                        (os.path.basename(mod), ` result[0]
                                         `, ` result[1] `, result[2].strip()))

        self.model.editor.statusBar.setHint(
            _('%d matches of "%s".') % (i, self.findPattern))

        self.pastelise()
Beispiel #10
0
 def refreshCtrl(self):
     ListCtrlView.refreshCtrl(self)
     if self.stats:
         self.statKeyList = self.stats.keys()
         self.statKeyList.sort()
         i = 0
         for filename, lineno, funcname in self.statKeyList:
             stats = self.stats[(filename, lineno, funcname)]
             i = self.addReportItems(
                 i, (os.path.basename(filename), str(lineno), funcname,
                     '%d' % stats[0], '%f' % stats[2], stats[0] and '%f' %
                     (stats[2] / stats[0]) or '', '%f' % stats[3],
                     stats[0] and '%f' % (stats[3] / stats[0]) or ''))
             self.SetItemData(i - 1, i - 1)
     self.pastelise()
Beispiel #11
0
    def __init__(self, parent, model):
        ListCtrlView.__init__(
            self, parent, model, wx.LC_REPORT,
            ((_('Goto file'), self.OnGoto, self.gotoLineBmp, ''), ), 0)

        self.sortOnColumns = [0, 1]

        self.InsertColumn(0, _('Name'))
        self.InsertColumn(1, _('#Todos'))
        self.InsertColumn(2, _('Filepath'))
        self.SetColumnWidth(0, 75)
        self.SetColumnWidth(1, 25)
        self.SetColumnWidth(2, 350)

        self.todos = []
        self.active = True
Beispiel #12
0
    def __init__(self, parent, model):
        CloseableViewMix.__init__(self, _('compare results'))
        ListCtrlView.__init__(self, parent, model, wx.LC_REPORT,
          ( ('Do diff', self.OnGoto, self.gotoLineBmp, ''), ) +\
           self.closingActionItems, 0)

        self.InsertColumn(0, _('Module'), width=100)
        self.InsertColumn(1, _('Differs from'), width=450)
        self.InsertColumn(2, _('Result'), width=75)

        self.results = {}
        self.listResultIdxs = []
        self.tabName = 'App. Compare'
        self.active = True
        self.model = model
        self.compareTo = ''
Beispiel #13
0
    def __init__(self, parent, model):
        CloseableViewMix.__init__(self, _('compare results'))
        ListCtrlView.__init__(self, parent, model, wx.LC_REPORT,
          ( ('Do diff', self.OnGoto, self.gotoLineBmp, ''), ) +\
           self.closingActionItems, 0)

        self.InsertColumn(0, _('Module'), width = 100)
        self.InsertColumn(1, _('Differs from'), width = 450)
        self.InsertColumn(2, _('Result'), width = 75)

        self.results = {}
        self.listResultIdxs = []
        self.tabName = 'App. Compare'
        self.active = True
        self.model = model
        self.compareTo = ''
Beispiel #14
0
    def refreshCtrl(self):
        ListCtrlView.refreshCtrl(self)

        todos = []
        prog = 0
        from Models.PythonEditorModels import ModuleModel

        absModPaths = self.model.absModulesPaths()
        progStep = 100.0 / len(absModPaths)
        for module in absModPaths:
            # module = 'file://'+absModPath
            self.model.editor.statusBar.progress.SetValue(int(prog * progStep))
            prog += 1
            self.model.editor.setStatus(_("Parsing %s...") % module)
            # module = self.modules[moduleName]
            # filename = self.normaliseModuleRelativeToApp(module[2])
            if module[:7] != "file://":
                print _("%s skipped, only local files supported for Imports View")
                continue
            else:
                fn = module[7:]
            try:
                f = open(fn)
            except IOError:
                print _("couldn't load %s") % module
                continue
            else:
                data = f.read()
                f.close()
                name = os.path.splitext(os.path.basename(module))[0]
                model = ModuleModel(data, name, self.model.editor, 1)

                m = model.getModule()
                if m.todos:
                    todos.append((name, len(m.todos), module))

        self.model.editor.statusBar.progress.SetValue(0)
        self.model.editor.setStatus(_("Finished parsing"))

        i = 0
        for name, numTodos, path in todos:
            self.addReportItems(i, (name, numTodos, path))
            i += 1

        self.pastelise()

        self.todos = todos
Beispiel #15
0
    def refreshCtrl(self):
        ListCtrlView.refreshCtrl(self)

        todos = []
        prog = 0
        from Models.PythonEditorModels import ModuleModel
        absModPaths = self.model.absModulesPaths()
        progStep = 100.0 / len(absModPaths)
        for module in absModPaths:
            #module = 'file://'+absModPath
            self.model.editor.statusBar.progress.SetValue(int(prog * progStep))
            prog += 1
            self.model.editor.setStatus(_('Parsing %s...') % module)
            #module = self.modules[moduleName]
            #filename = self.normaliseModuleRelativeToApp(module[2])
            if module[:7] != 'file://':
                print _(
                    '%s skipped, only local files supported for Imports View')
                continue
            else:
                fn = module[7:]
            try:
                f = open(fn)
            except IOError:
                print _("couldn't load %s") % module
                continue
            else:
                data = f.read()
                f.close()
                name = os.path.splitext(os.path.basename(module))[0]
                model = ModuleModel(data, name, self.model.editor, 1)

                m = model.getModule()
                if m.todos:
                    todos.append((name, len(m.todos), module))

        self.model.editor.statusBar.progress.SetValue(0)
        self.model.editor.setStatus(_('Finished parsing'))

        i = 0
        for name, numTodos, path in todos:
            self.addReportItems(i, (name, numTodos, path))
            i += 1

        self.pastelise()

        self.todos = todos
Beispiel #16
0
    def refreshCtrl(self):
        ListCtrlView.refreshCtrl(self)

        from Models.PythonEditorModels import BaseAppModel
        otherApp = BaseAppModel('', self.compareTo, '', self.model.editor,
                                True, {})

        from Explorers.Explorer import openEx
        otherApp.transport = openEx(self.compareTo)

        otherApp.load()
        otherApp.readModules()

        filename, otherFilename = self.model.assertLocalFile(
        ), otherApp.assertLocalFile()

        i = 0
        # Compare apps
        if not cmp(filename, otherFilename):
            i = self.addReportItems(i, (os.path.splitext(
                os.path.basename(filename))[0], otherFilename, _('changed')))

        # Find changed modules and modules not occuring in other module
        for module in self.model.modules.keys():
            if otherApp.modules.has_key(module):
                otherFile = otherApp.assertLocalFile(
                    otherApp.moduleFilename(module))
                filename = self.model.assertLocalFile(
                    self.model.moduleFilename(module))
                try:
                    if not cmp(filename, otherFile):
                        i = self.addReportItems(
                            i, (module, otherFile, _('changed')))
                except OSError:
                    pass
            else:
                i = self.addReportItems(i, (module, '', _('deleted')))

        # Find modules only occuring in other module
        for module in otherApp.modules.keys():
            if not self.model.modules.has_key(module):
                #otherFile = otherApp.moduleFilename(module)
                i = self.addReportItems(i, (module, '', _('added')))

        self.pastelise()
Beispiel #17
0
    def __init__(self, parent, model):
        CloseableViewMix.__init__(self, _('find results'))
        ListCtrlView.__init__(self, parent, model, wx.LC_REPORT, (
            (_('Goto match'), self.OnGoto, self.gotoLineBmp, ''),
            (_('Rerun query'), self.OnRerun, '-', ''),
        ) + self.closingActionItems, 0)

        self.InsertColumn(0, _('Module'), width=100)
        self.InsertColumn(1, _('Line no'), wx.LIST_FORMAT_CENTRE, 40)
        self.InsertColumn(2, _('Col'), wx.LIST_FORMAT_CENTRE, 40)
        self.InsertColumn(3, _('Text'), width=550)

        self.results = {}
        self.listResultIdxs = []
        self.tabName = 'Results'
        self.findPattern = ''
        self.active = True
        self.model = model
Beispiel #18
0
    def __init__(self, parent, model):
        CloseableViewMix.__init__(self, _('find results'))
        ListCtrlView.__init__(self, parent, model, wx.LC_REPORT,
          ( (_('Goto match'), self.OnGoto, self.gotoLineBmp, ''),
            (_('Rerun query'), self.OnRerun, '-', ''),
          ) +
            self.closingActionItems, 0)

        self.InsertColumn(0, _('Module'), width = 100)
        self.InsertColumn(1, _('Line no'), wx.LIST_FORMAT_CENTRE, 40)
        self.InsertColumn(2, _('Col'), wx.LIST_FORMAT_CENTRE, 40)
        self.InsertColumn(3, _('Text'), width = 550)

        self.results = {}
        self.listResultIdxs = []
        self.tabName = 'Results'
        self.findPattern = ''
        self.active = True
        self.model = model
Beispiel #19
0
    def refreshCtrl(self):
        ListCtrlView.refreshCtrl(self)

        from Models.PythonEditorModels import BaseAppModel

        otherApp = BaseAppModel("", self.compareTo, "", self.model.editor, True, {})

        from Explorers.Explorer import openEx

        otherApp.transport = openEx(self.compareTo)

        otherApp.load()
        otherApp.readModules()

        filename, otherFilename = self.model.assertLocalFile(), otherApp.assertLocalFile()

        i = 0
        # Compare apps
        if not cmp(filename, otherFilename):
            i = self.addReportItems(i, (os.path.splitext(os.path.basename(filename))[0], otherFilename, _("changed")))

        # Find changed modules and modules not occuring in other module
        for module in self.model.modules.keys():
            if otherApp.modules.has_key(module):
                otherFile = otherApp.assertLocalFile(otherApp.moduleFilename(module))
                filename = self.model.assertLocalFile(self.model.moduleFilename(module))
                try:
                    if not cmp(filename, otherFile):
                        i = self.addReportItems(i, (module, otherFile, _("changed")))
                except OSError:
                    pass
            else:
                i = self.addReportItems(i, (module, "", _("deleted")))

        # Find modules only occuring in other module
        for module in otherApp.modules.keys():
            if not self.model.modules.has_key(module):
                # otherFile = otherApp.moduleFilename(module)
                i = self.addReportItems(i, (module, "", _("added")))

        self.pastelise()
Beispiel #20
0
    def __init__(self, parent, model):
        CloseableViewMix.__init__(self, _("compare results"))
        ListCtrlView.__init__(
            self,
            parent,
            model,
            wx.LC_REPORT,
            (("Do diff", self.OnGoto, self.gotoLineBmp, ""),) + self.closingActionItems,
            0,
        )

        self.InsertColumn(0, _("Module"), width=100)
        self.InsertColumn(1, _("Differs from"), width=450)
        self.InsertColumn(2, _("Result"), width=75)

        self.results = {}
        self.listResultIdxs = []
        self.tabName = "App. Compare"
        self.active = True
        self.model = model
        self.compareTo = ""
Beispiel #21
0
    def __init__(self, parent, model):
        CloseableViewMix.__init__(self, _('stats'))
        ListCtrlView.__init__(self, parent, model, wx.LC_REPORT | wx.LC_SINGLE_SEL,
          ( (_('Goto line'), self.OnGoto, self.gotoLineBmp, ''),
            ('-', None, '', ''),
            (_('Callers (called this function)'), self.OnCallers, self.callersBmp, ''),
            (_('Callees (are called by this function)'), self.OnCallees, self.calleesBmp, ''),
            ('-', None, '', '') ) +
            self.closingActionItems +
          ( (_('Save stats'), self.OnSaveStats, self.saveAsBmp, ''),
            ), 0)

        self.InsertColumn(0, 'module')
        self.InsertColumn(1, 'line')
        self.InsertColumn(2, 'function')
        self.InsertColumn(3, 'ncalls')
        self.InsertColumn(4, 'tottime')
        self.InsertColumn(5, 'totpercall')
        self.InsertColumn(6, 'cumtime')
        self.InsertColumn(7, 'cumpercall')
        self.SetColumnWidth(0, 100)
        self.SetColumnWidth(1, 30)
        self.SetColumnWidth(2, 100)
        self.SetColumnWidth(3, 50)
        self.SetColumnWidth(4, 60)
        self.SetColumnWidth(5, 60)
        self.SetColumnWidth(6, 60)
        self.SetColumnWidth(7, 60)

        self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick)

        self.sortAscend = False
        self.sortCol = 0
        self.all_callees = None

        self.active = True
        self.stats = None
        self.profDir = ''
Beispiel #22
0
    def __init__(self, parent, model):
        CloseableViewMix.__init__(self, _('stats'))
        ListCtrlView.__init__(
            self, parent, model, wx.LC_REPORT | wx.LC_SINGLE_SEL,
            ((_('Goto line'), self.OnGoto, self.gotoLineBmp, ''),
             ('-', None, '', ''), (_('Callers (called this function)'),
                                   self.OnCallers, self.callersBmp, ''),
             (_('Callees (are called by this function)'), self.OnCallees,
              self.calleesBmp, ''),
             ('-', None, '', '')) + self.closingActionItems +
            ((_('Save stats'), self.OnSaveStats, self.saveAsBmp, ''), ), 0)

        self.InsertColumn(0, 'module')
        self.InsertColumn(1, 'line')
        self.InsertColumn(2, 'function')
        self.InsertColumn(3, 'ncalls')
        self.InsertColumn(4, 'tottime')
        self.InsertColumn(5, 'totpercall')
        self.InsertColumn(6, 'cumtime')
        self.InsertColumn(7, 'cumpercall')
        self.SetColumnWidth(0, 100)
        self.SetColumnWidth(1, 30)
        self.SetColumnWidth(2, 100)
        self.SetColumnWidth(3, 50)
        self.SetColumnWidth(4, 60)
        self.SetColumnWidth(5, 60)
        self.SetColumnWidth(6, 60)
        self.SetColumnWidth(7, 60)

        self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick)

        self.sortAscend = False
        self.sortCol = 0
        self.all_callees = None

        self.active = True
        self.stats = None
        self.profDir = ''
Beispiel #23
0
    def __init__(self, parent, model):
        CloseableViewMix.__init__(self, _("find results"))
        ListCtrlView.__init__(
            self,
            parent,
            model,
            wx.LC_REPORT,
            ((_("Goto match"), self.OnGoto, self.gotoLineBmp, ""), (_("Rerun query"), self.OnRerun, "-", ""))
            + self.closingActionItems,
            0,
        )

        self.InsertColumn(0, _("Module"), width=100)
        self.InsertColumn(1, _("Line no"), wx.LIST_FORMAT_CENTRE, 40)
        self.InsertColumn(2, _("Col"), wx.LIST_FORMAT_CENTRE, 40)
        self.InsertColumn(3, _("Text"), width=550)

        self.results = {}
        self.listResultIdxs = []
        self.tabName = "Results"
        self.findPattern = ""
        self.active = True
        self.model = model