Changeset fa65bfcc3049…
Parent 634c316c4e3e…
by
Changes to 2 files · Browse files at fa65bfcc3049 Showing diff from parent 634c316c4e3e Diff from another changeset...
@@ -192,6 +192,13 @@ ('opensubrepo', _('Open subrepository'), 'thg-repository-open',
'Alt+Ctrl+O', _('Open the selected subrepository'),
self.opensubrepo),
+ ('explore', _('Explore subrepository'), 'system-file-manager',
+ 'Alt+Ctrl+E', _('Open the selected subrepository'),
+ self.explore),
+ ('terminal', _('Open terminal in subrepository'),
+ 'utilities-terminal', 'Alt+Ctrl+T',
+ _('Open a shell terminal in the selected subrepository root'),
+ self.terminal),
]:
act = QAction(desc, self)
if icon:
@@ -278,6 +285,16 @@ _("Cannot open subrepository"),
_("The selected subrepository does not exist on the working directory"))
+ def explore(self):
+ root = os.path.join(self._repo.root, self.path)
+ if os.path.isdir(root):
+ QDesktopServices.openUrl(QUrl.fromLocalFile(root))
+
+ def terminal(self):
+ root = os.path.join(self._repo.root, self.path)
+ if os.path.isdir(root):
+ qtlib.openshell(root)
+
def showEvent(self, event):
QWidget.showEvent(self, event)
if self._selectedrev != self._rev:
@@ -287,7 +304,8 @@
#@pyqtSlot(QModelIndex)
def onDoubleClick(self, index):
- itemissubrepo = self.path in self._repo[self._rev].substate.keys()
+ currentindex = self._treeview.currentIndex()
+ itemissubrepo = (self._treemodel.fileStatus(currentindex) == 'S')
if itemissubrepo:
self.opensubrepo()
else:
@@ -295,12 +313,14 @@
def menuRequest(self, point):
point = self.mapToGlobal(point)
- itemissubrepo = self.path in self._repo[self._rev].substate.keys()
+
+ currentindex = self._treeview.currentIndex()
+ itemissubrepo = (self._treemodel.fileStatus(currentindex) == 'S')
# Subrepos and regular items have different context menus
if itemissubrepo:
contextmenu = self.subrepocontextmenu
- actionlist = ['opensubrepo']
+ actionlist = ['opensubrepo', 'explore', 'terminal']
else:
contextmenu = self.filecontextmenu
actionlist = ['diff', 'ldiff', 'edit', 'ledit', 'revert',
|
@@ -237,6 +237,13 @@ ('opensubrepo', _('Open subrepository'), 'thg-repository-open',
'Alt+Ctrl+O', _('Open the selected subrepository'),
self.opensubrepo),
+ ('explore', _('Explore subrepository'), 'system-file-manager',
+ 'Alt+Ctrl+E', _('Open the selected subrepository'),
+ self.explore),
+ ('terminal', _('Open terminal in subrepository'),
+ 'utilities-terminal', 'Alt+Ctrl+T',
+ _('Open a shell terminal in the selected subrepository root'),
+ self.terminal),
]:
act = QAction(desc, self)
if icon:
@@ -360,6 +367,16 @@ _("Cannot open subrepository"),
_("The selected subrepository does not exist on the working directory"))
+ def explore(self):
+ root = os.path.join(self.repo.root, self.filelist.currentFile())
+ if os.path.isdir(root):
+ QDesktopServices.openUrl(QUrl.fromLocalFile(root))
+
+ def terminal(self):
+ root = os.path.join(self.repo.root, self.filelist.currentFile())
+ if os.path.isdir(root):
+ qtlib.openshell(root)
+
#@pyqtSlot(QModelIndex)
def onDoubleClick(self, index):
model = self.filelist.model()
@@ -380,7 +397,7 @@ # Subrepos and regular items have different context menus
if itemissubrepo:
contextmenu = self.subrepocontextmenu
- actionlist = ['opensubrepo']
+ actionlist = ['opensubrepo', 'explore', 'terminal']
else:
contextmenu = self.filecontextmenu
actionlist = ['diff', 'ldiff', 'edit', 'ledit', 'revert',
|
Loading...