File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change
1
+ 2023-08-18 -- v0.8.3
2
+ -- Synchronize the scrolls of input/ouput boxes.
3
+
1
4
2023-08-17 -- v0.8.2
2
5
-- `txt` as a default extension for saving/opening file.
3
6
Original file line number Diff line number Diff line change 1
1
import platform
2
2
from pathlib import Path
3
3
4
- __version__ = "0.8.2 "
4
+ __version__ = "0.8.3 "
5
5
6
6
APPDATA = "AppData/Roaming/" if platform .system () == "Windows" else "."
7
7
SETTING_FILE = Path .home () / f"{ APPDATA } negar-gui/settings.toml"
Original file line number Diff line number Diff line change @@ -406,7 +406,26 @@ def connectSlots(self):
406
406
)
407
407
)
408
408
409
+ self .input_editor .verticalScrollBar ().valueChanged .connect (self ._sync_inout_scroll )
410
+ self .output_editor .verticalScrollBar ().valueChanged .connect (self ._sync_inout_scroll )
411
+
409
412
####################### SLOTs ###############################
413
+ def _sync_inout_scroll (self , value ):
414
+ max_in_scroll = self .input_editor .verticalScrollBar ().maximum ()
415
+ max_out_scroll = self .output_editor .verticalScrollBar ().maximum ()
416
+ sender = self .sender ()
417
+ if sender == self .input_editor .verticalScrollBar () and max_in_scroll != 0 :
418
+ new_value = int (value / max_in_scroll * max_out_scroll )
419
+ self .output_editor .verticalScrollBar ().valueChanged .disconnect (self ._sync_inout_scroll )
420
+ self .output_editor .verticalScrollBar ().setValue (new_value )
421
+ self .output_editor .verticalScrollBar ().valueChanged .connect (self ._sync_inout_scroll )
422
+
423
+ elif sender == self .output_editor .verticalScrollBar () and max_out_scroll != 0 :
424
+ new_value = int (value / max_out_scroll * max_in_scroll )
425
+ self .input_editor .verticalScrollBar ().valueChanged .disconnect (self ._sync_inout_scroll )
426
+ self .input_editor .verticalScrollBar ().setValue (new_value )
427
+ self .input_editor .verticalScrollBar ().valueChanged .connect (self ._sync_inout_scroll )
428
+
410
429
def full_screen_input_slot (self ):
411
430
(
412
431
self ._grid_full_input () if self .actionFull_Screen_Input .isChecked () else
You can’t perform that action at this time.
0 commit comments