@@ -88,7 +88,7 @@ class GuiState():
88
88
"ConvertToPython"
89
89
]
90
90
filters = {}
91
- lng_actions = {}
91
+ lng_actions = {}
92
92
item_map = {}
93
93
root_item : QTreeWidgetItem = None
94
94
mode_zoom : modes .ZoomMode = None
@@ -390,7 +390,8 @@ def python_print(*args, end="\n"):
390
390
391
391
392
392
def update_output ():
393
- GuiState .ui .txtOutput .setHtml ('<pre style="margin: 0">%s</pre>' % (ExecState .current_output + ExecState .after_output ))
393
+ GuiState .ui .txtOutput .setHtml (
394
+ '<pre style="margin: 0">%s</pre>' % (ExecState .current_output + ExecState .after_output ))
394
395
GuiState .ui .txtOutput .moveCursor (QTextCursor .End )
395
396
GuiState .ui .txtOutput .ensureCursorVisible ()
396
397
if ExecState .current_output .endswith ("\n \n " ):
@@ -496,8 +497,10 @@ def plot_window(xmin, xmax, ymin, ymax, xgrad=0, ygrad=0):
496
497
GuiState .plot_axes .set_xlim (xmin , xmax )
497
498
GuiState .plot_axes .set_ylim (ymin , ymax )
498
499
499
- GuiState .plot_axes .get_xaxis ().set_major_locator (AutoLocator () if xgrad == 0 else LinearLocator (abs (int ((xmax - xmin ) / xgrad )) + 1 ))
500
- GuiState .plot_axes .get_yaxis ().set_major_locator (AutoLocator () if ygrad == 0 else LinearLocator (abs (int ((ymax - ymin ) / ygrad )) + 1 ))
500
+ GuiState .plot_axes .get_xaxis ().set_major_locator (
501
+ AutoLocator () if xgrad == 0 else LinearLocator (abs (int ((xmax - xmin ) / xgrad )) + 1 ))
502
+ GuiState .plot_axes .get_yaxis ().set_major_locator (
503
+ AutoLocator () if ygrad == 0 else LinearLocator (abs (int ((ymax - ymin ) / ygrad )) + 1 ))
501
504
502
505
503
506
def plot_point (x , y , color = "red" ):
@@ -910,7 +913,8 @@ def handler_Save():
910
913
911
914
912
915
def handler_Open ():
913
- sel_file , _ = QFileDialog .getOpenFileName (GuiState .window , translate ("MainWindow" , "Open" ), "" , ";;" .join (GuiState .filters .values ()))
916
+ sel_file , _ = QFileDialog .getOpenFileName (GuiState .window , translate ("MainWindow" , "Open" ), "" ,
917
+ ";;" .join (GuiState .filters .values ()))
914
918
915
919
if not sel_file :
916
920
return
@@ -1074,7 +1078,7 @@ def clear_output():
1074
1078
1075
1079
def print_output ():
1076
1080
print (dir (GuiState .code_editor ))
1077
-
1081
+
1078
1082
p = QGuiApplication .palette ()
1079
1083
print (p .color (QPalette .Window ).name ())
1080
1084
print (p .color (QPalette .WindowText ).name ())
@@ -1208,14 +1212,16 @@ def load_code_editor():
1208
1212
1209
1213
GuiState .mode_ext_select = GuiState .code_editor .modes .append (modes .ExtendedSelectionMode ())
1210
1214
1211
- GuiState .syntax_highlighter = GuiState .code_editor .modes .append (modes .PygmentsSyntaxHighlighter (GuiState .code_editor .document ()))
1215
+ GuiState .syntax_highlighter = GuiState .code_editor .modes .append (
1216
+ modes .PygmentsSyntaxHighlighter (GuiState .code_editor .document ()))
1212
1217
GuiState .syntax_highlighter .fold_detector = api .IndentFoldDetector ()
1213
1218
1214
1219
GuiState .panel_folding = GuiState .code_editor .panels .append (panels .FoldingPanel ())
1215
1220
GuiState .code_editor .panels .append (panels .LineNumberPanel ())
1216
1221
GuiState .code_editor .modes .append (modes .CheckerMode (pyqode .python .backend .run_pep8 ))
1217
1222
GuiState .code_editor .panels .append (panels .GlobalCheckerPanel (), panels .GlobalCheckerPanel .Position .LEFT )
1218
- GuiState .panel_search = GuiState .code_editor .panels .append (panels .SearchAndReplacePanel (), api .Panel .Position .BOTTOM )
1223
+ GuiState .panel_search = GuiState .code_editor .panels .append (panels .SearchAndReplacePanel (),
1224
+ api .Panel .Position .BOTTOM )
1219
1225
1220
1226
GuiState .panel_search ._update_label_matches_orig = GuiState .panel_search ._update_label_matches
1221
1227
@@ -1786,8 +1792,8 @@ def str_stmt(stmt):
1786
1792
ret = translate ("Algo" , "[k]DECLARE[/k] [c]{var}[/c]" ).format (var = stmt .variable )
1787
1793
else :
1788
1794
ret = (translate ("Algo" , "[c]{var}[/c] [k]🡨[/k] [c]{value}[/c]" )
1789
- if GuiState .ui .actionUseArrowNotation .isChecked ()
1790
- else translate ("Algo" , "[k]VARIABLE[/k] [c]{var}[/c] [k]TAKES VALUE[/k] [c]{value}[/c]" )).format (
1795
+ if GuiState .ui .actionUseArrowNotation .isChecked ()
1796
+ else translate ("Algo" , "[k]VARIABLE[/k] [c]{var}[/c] [k]TAKES VALUE[/k] [c]{value}[/c]" )).format (
1791
1797
var = code (stmt .variable ),
1792
1798
value = code (stmt .value ))
1793
1799
@@ -2023,7 +2029,7 @@ def algo_scroll(event: QWheelEvent):
2023
2029
handler_ZoomIn ()
2024
2030
elif event .angleDelta ().y () < 0 :
2025
2031
handler_ZoomOut ()
2026
-
2032
+
2027
2033
event .accept ()
2028
2034
else :
2029
2035
GuiState .ui .treeWidget .wheelEventOrig (event )
@@ -2034,8 +2040,8 @@ def fix_qt_shitty_margins():
2034
2040
if wgt .text ():
2035
2041
wgt .setText (" " + wgt .text ())
2036
2042
wgt .setMinimumHeight (28 )
2037
-
2038
-
2043
+
2044
+
2039
2045
def init_theme_actions ():
2040
2046
def gen (s ):
2041
2047
return lambda : set_theme (s )
@@ -2078,7 +2084,7 @@ def init_ui():
2078
2084
GuiState .ui .menubar .setCornerWidget (right_corner )
2079
2085
2080
2086
init_event_handlers ()
2081
-
2087
+
2082
2088
init_theme_actions ()
2083
2089
2084
2090
algo_sel_changed ()
@@ -2099,7 +2105,8 @@ def init_ui():
2099
2105
2100
2106
center_widget (GuiState .window , None )
2101
2107
GuiState .window .show ()
2102
-
2108
+
2109
+
2103
2110
def init_event_handlers ():
2104
2111
GuiState .ui .btnSendInput .clicked .connect (send_user_input )
2105
2112
GuiState .ui .btnClearOutput .clicked .connect (clear_output )
@@ -2140,7 +2147,7 @@ def init_event_handlers():
2140
2147
2141
2148
GuiState .ui .treeWidget .itemSelectionChanged .connect (algo_sel_changed )
2142
2149
GuiState .ui .treeWidget .itemDoubleClicked .connect (algo_double_click )
2143
-
2150
+
2144
2151
GuiState .ui .treeWidget .wheelEventOrig = GuiState .ui .treeWidget .wheelEvent
2145
2152
GuiState .ui .treeWidget .wheelEvent = algo_scroll
2146
2153
@@ -2157,7 +2164,7 @@ def autosave_write():
2157
2164
content = repr (AppState .algo )
2158
2165
2159
2166
util .settings .setValue ("autosave_content" , content )
2160
-
2167
+
2161
2168
2162
2169
def autosave_tick ():
2163
2170
if AppState .app_started :
0 commit comments