Workaround for missing lines at vertical scroll bar caused by annotations. 6_0_x

Thu, 03 Sep 2015 23:01:02 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Thu, 03 Sep 2015 23:01:02 +0200
branch
6_0_x
changeset 4440
d3c84c471c32
parent 4439
1d7d42500f54
child 4441
88fcd0a1e58f

Workaround for missing lines at vertical scroll bar caused by annotations.
(grafted from 7ab862396a8abb99f45679bf1f2c63d955631abd)

Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py file | annotate | diff | comparison | revisions
Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
QScintilla/QsciScintillaCompat.py file | annotate | diff | comparison | revisions
--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py	Sun Sep 06 11:23:53 2015 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py	Thu Sep 03 23:01:02 2015 +0200
@@ -630,6 +630,9 @@
             else:
                 editor.toggleWarning(
                     lineno, 0, True, message, warningType=editor.WarningStyle)
+            
+            editor = vm.activeWindow()
+            editor.updateVerticalScrollBar()
     
     @pyqtSlot()
     def on_resultList_itemSelectionChanged(self):
@@ -676,6 +679,9 @@
             if file not in errorFiles:
                 editor = vm.getOpenEditor(file)
                 editor.clearStyleWarnings()
+        
+        editor = vm.activeWindow()
+        editor.updateVerticalScrollBar()
     
     @pyqtSlot()
     def on_statisticsButton_clicked(self):
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py	Sun Sep 06 11:23:53 2015 +0200
+++ b/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py	Thu Sep 03 23:01:02 2015 +0200
@@ -329,13 +329,14 @@
         if self.noResults:
             return
         
+        vm = e5App().getObject("ViewManager")
+        
         if itm.parent():
             fn = Utilities.normabspath(itm.data(0, self.filenameRole))
             lineno = itm.data(0, self.lineRole)
             index = itm.data(0, self.indexRole)
             error = itm.data(0, self.errorRole)
             
-            vm = e5App().getObject("ViewManager")
             vm.openSourceFile(fn, lineno)
             editor = vm.getOpenEditor(fn)
             
@@ -345,7 +346,6 @@
                 editor.toggleSyntaxError(lineno, index, True, error, show=True)
         else:
             fn = Utilities.normabspath(itm.data(0, self.filenameRole))
-            vm = e5App().getObject("ViewManager")
             vm.openSourceFile(fn)
             editor = vm.getOpenEditor(fn)
             for index in range(itm.childCount()):
@@ -359,6 +359,9 @@
                     editor.toggleSyntaxError(
                         lineno, index, True, error, show=True)
         
+        editor = vm.activeWindow()
+        editor.updateVerticalScrollBar()
+        
     @pyqtSlot()
     def on_showButton_clicked(self):
         """
@@ -404,6 +407,9 @@
                 editor.clearSyntaxError()
                 editor.clearFlakesWarnings()
         
+        editor = vm.activeWindow()
+        editor.updateVerticalScrollBar()
+        
     def __clearErrors(self, files):
         """
         Private method to clear all error and warning markers of
--- a/QScintilla/Editor.py	Sun Sep 06 11:23:53 2015 +0200
+++ b/QScintilla/Editor.py	Thu Sep 03 23:01:02 2015 +0200
@@ -5137,6 +5137,8 @@
         warnings = problems.get('warnings', [])
         for _fn, lineno, col, code, msg in warnings:
             self.toggleWarning(lineno, col, True, msg)
+        
+        self.updateVerticalScrollBar()
  
     def __initOnlineSyntaxCheck(self):
         """
--- a/QScintilla/QsciScintillaCompat.py	Sun Sep 06 11:23:53 2015 +0200
+++ b/QScintilla/QsciScintillaCompat.py	Thu Sep 03 23:01:02 2015 +0200
@@ -1338,6 +1338,15 @@
         """
         self.activateWindow()
     
+    def updateVerticalScrollBar(self):
+        """
+        Public method to update the vertical scroll bar to reflect the
+        additional lines added by annotations.
+        """
+        # Workaround because Scintilla.Redraw isn't implemented
+        self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 0)
+        self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 1)
+    
     ###########################################################################
     ## utility methods
     ###########################################################################

eric ide

mercurial