Virgil Dupras avatar Virgil Dupras committed 3a6acd9

Fixed a bug under Qt where new tabs opened after startup wouldn't have the correct font size.

Comments (0)

Files changed (3)

         self.connect(self, SIGNAL('applicationFinishedLaunching()'), self.applicationFinishedLaunching)
         QCoreApplication.instance().aboutToQuit.connect(self.applicationWillTerminate)
 
-        self.prefsChanged.emit(self.prefs)
+        self.prefsChanged.emit()
     
     #--- Public
     def askForRegCode(self):
         self.preferencesPanel.load()
         if self.preferencesPanel.exec_() == QDialog.Accepted:
             self.preferencesPanel.save()
-            self.prefsChanged.emit(self.prefs)
+            self.prefsChanged.emit()
     
     #--- Event Handling
     def applicationFinishedLaunching(self):
         self.model.shutdown()
     
     #--- Signals
-    prefsChanged = pyqtSignal(object)
+    prefsChanged = pyqtSignal()
     willSavePrefs = pyqtSignal()
     
     #--- model --> view

qt/controller/account_sheet.py

         self.columns = Columns(self.model.columns, self.COLUMNS, view.header())
         self.accountSheetDelegate = AccountSheetDelegate(self)
         self.view.setItemDelegate(self.accountSheetDelegate)
+        self._updateFontSize()
         
         self.view.selectionModel().selectionChanged[(QItemSelection, QItemSelection)].connect(self.selectionChanged)
         self.view.collapsed.connect(self.nodeCollapsed)
         modelIndex = self.findIndex(selectedPath)
         self.view.setCurrentIndex(modelIndex)
     
+    def _updateFontSize(self):
+        from ..app import APP_INSTANCE
+        font = self.view.font()
+        font.setPointSize(APP_INSTANCE.prefs.tableFontSize)
+        self.view.setFont(font)
+
     #--- Data Model methods
     def columnCount(self, parent):
         return self.model.columns.columns_count()
         return Qt.MoveAction
     
     #--- Events
-    def appPrefsChanged(self, prefs):
-        font = self.view.font()
-        font.setPointSize(prefs.tableFontSize)
-        self.view.setFont(font)
+    def appPrefsChanged(self):
+        self._updateFontSize()
 
     def selectionChanged(self, selected, deselected):
         newNodes = [modelIndex.internalPointer().ref for modelIndex in self.view.selectionModel().selectedRows()]

qt/controller/table.py

         TableBase.__init__(self, model, view)
         self.tableDelegate = TableDelegate(self.model)
         self.view.setItemDelegate(self.tableDelegate)
+        self._updateFontSize()
         from ..app import APP_INSTANCE
         APP_INSTANCE.prefsChanged.connect(self.appPrefsChanged)
 
-    def appPrefsChanged(self, prefs):
+    def _updateFontSize(self):
+        from ..app import APP_INSTANCE
         font = self.view.font()
-        font.setPointSize(prefs.tableFontSize)
+        font.setPointSize(APP_INSTANCE.prefs.tableFontSize)
         self.view.setFont(font)
         fm = QFontMetrics(font)
         self.view.verticalHeader().setDefaultSectionSize(fm.height()+2)
+
+    def appPrefsChanged(self):
+        self._updateFontSize()
     
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.