diff options
author | Rael Gugelmin Cunha <rael.gc@gmail.com> | 2015-10-15 07:22:46 -0300 |
---|---|---|
committer | Rael Gugelmin Cunha <rael.gc@gmail.com> | 2015-10-15 07:22:46 -0300 |
commit | 381638778fd474854c9c8e9858659f2857f569e3 (patch) | |
tree | ec0bd81aaff56bcbe64b40203578a08f7fb05e37 | |
parent | 456cbf6ea74020423bc130a47171cb975251e913 (diff) | |
parent | 82b7e3c75ccd52d4d71cc305997491da0376e384 (diff) | |
download | scudcloud-381638778fd474854c9c8e9858659f2857f569e3.zip scudcloud-381638778fd474854c9c8e9858659f2857f569e3.tar.gz scudcloud-381638778fd474854c9c8e9858659f2857f569e3.tar.bz2 |
Merge pull request #260 from raelgc/259-edit-menu-entries-are-always-attached-to-first-team
Updating Edit menu on team switch (Fixes #259)
-rw-r--r-- | scudcloud-1.0/debian/control | 1 | ||||
-rwxr-xr-x | scudcloud-1.0/lib/scudcloud.py | 52 |
2 files changed, 26 insertions, 27 deletions
diff --git a/scudcloud-1.0/debian/control b/scudcloud-1.0/debian/control index b4ed8f9..d25cae5 100644 --- a/scudcloud-1.0/debian/control +++ b/scudcloud-1.0/debian/control @@ -11,7 +11,6 @@ Architecture: all Depends: libqtwebkit4 (>= 2.3.2), python3, python3-dbus, - python3-dbus.mainloop.qt, python3-pyqt4, xdg-utils, ${misc:Depends} diff --git a/scudcloud-1.0/lib/scudcloud.py b/scudcloud-1.0/lib/scudcloud.py index e1bc8ad..82755cc 100755 --- a/scudcloud-1.0/lib/scudcloud.py +++ b/scudcloud-1.0/lib/scudcloud.py @@ -14,13 +14,6 @@ from PyQt4.QtCore import QUrl, QSettings from PyQt4.QtWebKit import QWebSettings, QWebPage from PyQt4.QtNetwork import QNetworkDiskCache -# Auto-detection of dbus and dbus.mainloop.qt -try: - import dbus - from dbus.mainloop.qt import DBusQtMainLoop -except ImportError: - DBusQtMainLoop = None - # Auto-detection of Unity and Dbusmenu in gi repository try: from gi.repository import Unity, Dbusmenu @@ -168,14 +161,6 @@ class ScudCloud(QtGui.QMainWindow): "exit": self.createAction("Quit", self.exit, QKeySequence.Quit) }, "edit": { - "undo": self.current().pageAction(QtWebKit.QWebPage.Undo), - "redo": self.current().pageAction(QtWebKit.QWebPage.Redo), - "cut": self.current().pageAction(QtWebKit.QWebPage.Cut), - "copy": self.current().pageAction(QtWebKit.QWebPage.Copy), - "paste": self.current().pageAction(QtWebKit.QWebPage.Paste), - "back": self.current().pageAction(QtWebKit.QWebPage.Back), - "forward": self.current().pageAction(QtWebKit.QWebPage.Forward), - "reload": self.current().pageAction(QtWebKit.QWebPage.Reload) }, "view": { "zoomin": self.createAction("Zoom In", self.zoomIn, QKeySequence.ZoomIn), @@ -200,17 +185,8 @@ class ScudCloud(QtGui.QMainWindow): fileMenu.addSeparator() fileMenu.addAction(self.menus["file"]["close"]) fileMenu.addAction(self.menus["file"]["exit"]) - editMenu = menu.addMenu("&Edit") - editMenu.addAction(self.menus["edit"]["undo"]) - editMenu.addAction(self.menus["edit"]["redo"]) - editMenu.addSeparator() - editMenu.addAction(self.menus["edit"]["cut"]) - editMenu.addAction(self.menus["edit"]["copy"]) - editMenu.addAction(self.menus["edit"]["paste"]) - editMenu.addSeparator() - editMenu.addAction(self.menus["edit"]["back"]) - editMenu.addAction(self.menus["edit"]["forward"]) - editMenu.addAction(self.menus["edit"]["reload"]) + self.editMenu = menu.addMenu("&Edit") + self.updateEditMenu() viewMenu = menu.addMenu("&View") viewMenu.addAction(self.menus["view"]["zoomin"]) viewMenu.addAction(self.menus["view"]["zoomout"]) @@ -235,6 +211,29 @@ class ScudCloud(QtGui.QMainWindow): self.menus["file"]["signout"].setEnabled(enabled == True) self.menus["help"]["help"].setEnabled(enabled == True) + def updateEditMenu(self): + self.editMenu.clear() + self.menus["edit"] = { + "undo": self.current().pageAction(QtWebKit.QWebPage.Undo), + "redo": self.current().pageAction(QtWebKit.QWebPage.Redo), + "cut": self.current().pageAction(QtWebKit.QWebPage.Cut), + "copy": self.current().pageAction(QtWebKit.QWebPage.Copy), + "paste": self.current().pageAction(QtWebKit.QWebPage.Paste), + "back": self.current().pageAction(QtWebKit.QWebPage.Back), + "forward": self.current().pageAction(QtWebKit.QWebPage.Forward), + "reload": self.current().pageAction(QtWebKit.QWebPage.Reload) + } + self.editMenu.addAction(self.menus["edit"]["undo"]) + self.editMenu.addAction(self.menus["edit"]["redo"]) + self.editMenu.addSeparator() + self.editMenu.addAction(self.menus["edit"]["cut"]) + self.editMenu.addAction(self.menus["edit"]["copy"]) + self.editMenu.addAction(self.menus["edit"]["paste"]) + self.editMenu.addSeparator() + self.editMenu.addAction(self.menus["edit"]["back"]) + self.editMenu.addAction(self.menus["edit"]["forward"]) + self.editMenu.addAction(self.menus["edit"]["reload"]) + def createAction(self, text, slot, shortcut=None, checkable=False): action = QtGui.QAction(text, self) action.triggered.connect(slot) @@ -273,6 +272,7 @@ class ScudCloud(QtGui.QMainWindow): if not exists: self.addWrapper(url) self.enableMenus(self.current().isConnected()) + self.updateEditMenu() def eventFilter(self, obj, event): if event.type() == QtCore.QEvent.ActivationChange and self.isActiveWindow(): |