class SearchResultsDock(PrymatexDock, Ui_SearchDock, QtWidgets.QDockWidget): ICON = "dock-search-results" PREFERED_AREA = QtCore.Qt.BottomDockWidgetArea def __init__(self, **kwargs): super(SearchResultsDock, self).__init__(**kwargs) self.setupUi(self) self.searchTreeModel = SearchTreeModel(self) self.treeView.setModel(self.searchTreeModel) def on_actionFileSearch_triggered(self): if not self.isVisible(): self.show() self.raise_() #fileSearch = PMXFileSearchDialog.search(self.searchTreeModel, self) #TODO: Si no se encontro nada o se cancelo cerrarlo @classmethod def contributeToMainMenu(cls): edit = [ '-', {'text': 'File Search', 'callback': cls.on_actionFileSearch_triggered } ] return { "edit": edit } def on_treeView_activated(self, index): node = self.searchTreeModel.node(index) if isinstance(node, LineTreeNode): self.application.openFile(node.path(), cursorPosition = (node.lineNumber - 1, 0)) def on_treeView_doubleClicked(self, index): node = self.searchTreeModel.node(index) if isinstance(node, LineTreeNode): self.application.openFile(node.path(), cursorPosition = (node.lineNumber - 1, 0))
class PMXSearchDock(QtGui.QDockWidget, Ui_SearchDock, PMXBaseDock): SHORTCUT = "Shift+F4" ICON = resources.getIcon("edit-find-project") PREFERED_AREA = QtCore.Qt.BottomDockWidgetArea def __init__(self, parent): QtGui.QDockWidget.__init__(self, parent) PMXBaseDock.__init__(self) self.setupUi(self) self.searchTreeModel = SearchTreeModel(self) self.treeView.setModel(self.searchTreeModel) def on_actionFileSearch_triggered(self): if not self.isVisible(): self.show() self.raise_() fileSearch = PMXFileSearchDialog.search(self.searchTreeModel, self) #TODO: Si no se encontro nada o se cancelo cerrarlo @classmethod def contributeToMainMenu(cls, addonClasses): edit = { 'items': [ "-", { 'text': "File Search", 'callback': cls.on_actionFileSearch_triggered } ] } return {"Edit": edit} def on_treeView_activated(self, index): node = self.searchTreeModel.node(index) if isinstance(node, LineTreeNode): self.application.openFile(node.path(), cursorPosition=(node.lineNumber - 1, 0)) def on_treeView_doubleClicked(self, index): node = self.searchTreeModel.node(index) if isinstance(node, LineTreeNode): self.application.openFile(node.path(), cursorPosition=(node.lineNumber - 1, 0))
class PMXSearchDock(QtGui.QDockWidget, Ui_SearchDock, PMXBaseDock): SHORTCUT = "Shift+F4" ICON = resources.getIcon("edit-find-project") PREFERED_AREA = QtCore.Qt.BottomDockWidgetArea def __init__(self, parent): QtGui.QDockWidget.__init__(self, parent) PMXBaseDock.__init__(self) self.setupUi(self) self.searchTreeModel = SearchTreeModel(self) self.treeView.setModel(self.searchTreeModel) def on_actionFileSearch_triggered(self): if not self.isVisible(): self.show() self.raise_() fileSearch = PMXFileSearchDialog.search(self.searchTreeModel, self) #TODO: Si no se encontro nada o se cancelo cerrarlo @classmethod def contributeToMainMenu(cls, addonClasses): edit = { 'items': [ "-", {'text': "File Search", 'callback': cls.on_actionFileSearch_triggered } ]} return { "Edit": edit } def on_treeView_activated(self, index): node = self.searchTreeModel.node(index) if isinstance(node, LineTreeNode): self.application.openFile(node.path(), cursorPosition = (node.lineNumber - 1, 0)) def on_treeView_doubleClicked(self, index): node = self.searchTreeModel.node(index) if isinstance(node, LineTreeNode): self.application.openFile(node.path(), cursorPosition = (node.lineNumber - 1, 0))
def __init__(self, parent): QtGui.QDockWidget.__init__(self, parent) PMXBaseDock.__init__(self) self.setupUi(self) self.searchTreeModel = SearchTreeModel(self) self.treeView.setModel(self.searchTreeModel)
def __init__(self, **kwargs): super(SearchResultsDock, self).__init__(**kwargs) self.setupUi(self) self.searchTreeModel = SearchTreeModel(self) self.treeView.setModel(self.searchTreeModel)