aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRael Gugelmin Cunha <rael.gc@gmail.com>2015-09-25 07:37:16 -0300
committerRael Gugelmin Cunha <rael.gc@gmail.com>2015-09-25 07:37:16 -0300
commite07d9c294e72eb211c882ec72d982cc493a10334 (patch)
tree7e208ebb0e683d35fc671322526706e1752543a0
parenta3afff3083fe2452d4efde81db68a41694143a09 (diff)
parent28a0312696a643704e155b00dd275bb630514af7 (diff)
downloadscudcloud-e07d9c294e72eb211c882ec72d982cc493a10334.zip
scudcloud-e07d9c294e72eb211c882ec72d982cc493a10334.tar.gz
scudcloud-e07d9c294e72eb211c882ec72d982cc493a10334.tar.bz2
Merge pull request #233 from mbra/toggle_menubar_visibility
Allow the menubar to be hidden on non Unity environments
-rwxr-xr-xscudcloud-1.0/lib/scudcloud.py12
-rw-r--r--scudcloud-1.0/lib/systray.py6
2 files changed, 16 insertions, 2 deletions
diff --git a/scudcloud-1.0/lib/scudcloud.py b/scudcloud-1.0/lib/scudcloud.py
index 2fe7fd6..debc808 100755
--- a/scudcloud-1.0/lib/scudcloud.py
+++ b/scudcloud-1.0/lib/scudcloud.py
@@ -102,6 +102,10 @@ class ScudCloud(QtGui.QMainWindow):
else:
self.showFullScreen()
+ def toggleMenuBar(self):
+ menu = self.menuBar()
+ menu.setVisible(menu.isHidden())
+
def restore(self):
geometry = self.settings.value("geometry")
if geometry is not None:
@@ -170,7 +174,8 @@ class ScudCloud(QtGui.QMainWindow):
"zoomin": self.createAction("Zoom In", self.zoomIn, QKeySequence.ZoomIn),
"zoomout": self.createAction("Zoom Out", self.zoomOut, QKeySequence.ZoomOut),
"reset": self.createAction("Reset", self.zoomReset, QtCore.Qt.CTRL + QtCore.Qt.Key_0),
- "fullscreen": self.createAction("Toggle Full Screen", self.toggleFullScreen, QtCore.Qt.Key_F11)
+ "fullscreen": self.createAction("Toggle Full Screen", self.toggleFullScreen, QtCore.Qt.Key_F11),
+ "hidemenu": self.createAction("Toggle Menubar", self.toggleMenuBar, QtCore.Qt.Key_F12)
},
"help": {
"help": self.createAction("Help and Feedback", lambda : self.current().help(), QKeySequence.HelpContents),
@@ -205,6 +210,8 @@ class ScudCloud(QtGui.QMainWindow):
viewMenu.addAction(self.menus["view"]["reset"])
viewMenu.addSeparator()
viewMenu.addAction(self.menus["view"]["fullscreen"])
+ if Unity is None:
+ viewMenu.addAction(self.menus["view"]["hidemenu"])
helpMenu = menu.addMenu("&Help")
helpMenu.addAction(self.menus["help"]["help"])
helpMenu.addAction(self.menus["help"]["center"])
@@ -223,9 +230,10 @@ class ScudCloud(QtGui.QMainWindow):
def createAction(self, text, slot, shortcut=None, checkable=False):
action = QtGui.QAction(text, self)
+ action.triggered.connect(slot)
if shortcut is not None:
action.setShortcut(shortcut)
- action.triggered.connect(slot)
+ self.addAction(action)
if checkable:
action.setCheckable(True)
return action
diff --git a/scudcloud-1.0/lib/systray.py b/scudcloud-1.0/lib/systray.py
index dc2ec73..68b7600 100644
--- a/scudcloud-1.0/lib/systray.py
+++ b/scudcloud-1.0/lib/systray.py
@@ -1,5 +1,6 @@
from PyQt4 import QtCore, QtGui
from resources import Resources
+import scudcloud
class Systray(QtGui.QSystemTrayIcon):
@@ -12,6 +13,8 @@ class Systray(QtGui.QSystemTrayIcon):
self.setToolTip(Resources.APP_NAME)
self.menu = QtGui.QMenu(self.window)
self.menu.addAction('Show', self.restore)
+ if scudcloud.Unity is None:
+ self.menu.addAction('Toggle Menubar', self.toggleMenuBar)
self.menu.addSeparator()
self.menu.addAction(self.window.menus["file"]["preferences"])
self.menu.addAction(self.window.menus["help"]["about"])
@@ -43,6 +46,9 @@ class Systray(QtGui.QSystemTrayIcon):
self.window.show()
self.stopAlert()
+ def toggleMenuBar(self):
+ self.window.toggleMenuBar()
+
def activatedEvent(self, reason):
if reason in [QtGui.QSystemTrayIcon.MiddleClick, QtGui.QSystemTrayIcon.Trigger]:
if self.window.isHidden() or self.window.isMinimized() or not self.window.isActiveWindow():