add main menu shotcuts and make first openened file displayed

Fri, 18 Jan 2008 16:33:51 +0100

author
David Douard <david.douard@logilab.fr>
date
Fri, 18 Jan 2008 16:33:51 +0100
changeset 25
32d0d1cd44c3
parent 24
44866ca03611
child 26
e8f3c9276f3f

add main menu shotcuts and make first openened file displayed

qgpib_plotter.py file | annotate | diff | comparison | revisions
--- a/qgpib_plotter.py	Wed Jan 16 01:21:06 2008 +0100
+++ b/qgpib_plotter.py	Fri Jan 18 16:33:51 2008 +0100
@@ -43,10 +43,13 @@
                      self.preferencesTriggered)
         self.connect(self.actionQuit, SIGNAL('triggered(bool)'),
                      self.quitTriggered)
+        self.actionQuit.setShortcut(QtGui.QKeySequence(u'Ctrl+Q'))
         self.connect(self.actionOpen, SIGNAL('triggered(bool)'),
                      self.openTriggered)
+        self.actionOpen.setShortcut(QtGui.QKeySequence(u'Ctrl+O'))
         self.connect(self.actionSave, SIGNAL('triggered(bool)'),
                      self.saveTriggered)
+        self.actionSave.setShortcut(QtGui.QKeySequence(u'Ctrl+S'))
         self.connect(self.actionSaveAs, SIGNAL('triggered(bool)'),
                      self.saveAsTriggered)
 
@@ -101,9 +104,9 @@
                 lst.append(name)            
                 self._plots[name] = data
                 self.plotsView.model().setStringList(lst)
-                #self.plotsView.setCurrentIndex(self.plotsView.model().index(self.plotsView.model().stringList().count(), 0))
-            
-            
+
+        if not self.plotsView.currentIndex().isValid():
+            self.plotsView.setCurrentIndex(self.plotsView.model().index(0, 0))
         
     def saveTriggered(self, checked=False):
         print "save"

mercurial