11
11
from PyQt5 .QtWidgets import QApplication , QMainWindow , QTextEdit , QMenu , QFileDialog , QAction , QMessageBox , QStatusBar
12
12
13
13
# QuackHak by CaliNux
14
+ # thank you to Wesley for the bug reports!
14
15
15
16
dark_stylesheet = """
16
17
QMainWindow, QMenuBar, QMenuBar::item, QMenu, QMenu::item {
@@ -317,7 +318,14 @@ def loadFreshCode(self):
317
318
318
319
pyautogui .press ('delete' )
319
320
321
+ def disableUserInteraction (self ):
322
+ self .text_edit .setReadOnly (True )
323
+
324
+ def enableUserInteraction (self ):
325
+ self .text_edit .setReadOnly (False )
326
+
320
327
def executeScript (self ):
328
+ self .disableUserInteraction ()
321
329
script_content = self .text_edit .toPlainText ()
322
330
323
331
if not script_content .strip ():
@@ -423,7 +431,12 @@ def executeScript(self):
423
431
elif line in ["F1" , "F2" , "F3" , "F4" , "F5" , "F6" , "F7" , "F8" , "F9" , "F10" , "F11" , "F12" ]:
424
432
pyautogui .press (line .lower ())
425
433
434
+ time .sleep (1 )
435
+
436
+ self .enableUserInteraction ()
437
+
426
438
def runScript (self ):
439
+ self .disableUserInteraction ()
427
440
script_content = self .text_edit .toPlainText ()
428
441
start_index = script_content .find ('powershell' )
429
442
end_index = script_content .find ('ENTER' )
@@ -446,6 +459,12 @@ def runScript(self):
446
459
time .sleep (1 )
447
460
pyautogui .press ('enter' )
448
461
462
+ time .sleep (1 )
463
+
464
+ self .enableUserInteraction ()
465
+
466
+
467
+
449
468
def uppercaseKeywords (self , text ):
450
469
always_upper = ['alt' , 'ctrl' , 'shift' , 'delete' , 'f1' , 'f2' , 'f3' , 'f4' , 'f5' , 'f6' , 'f7' , 'f8' , 'f9' , 'f10' ,
451
470
'f11' , 'f12' , 'control' , 'up' , 'down' , 'right' , 'left' , 'uparrow' , 'downarrow' , 'rightarrow' , 'leftarrow' , 'tab' , 'enter' ,
@@ -674,10 +693,10 @@ def main():
674
693
window = CodeEditor ()
675
694
window .setWindowTitle ('QuackHak Studio' )
676
695
677
- window .setGeometry (100 , 100 , 2100 , 500 )
696
+ window .setGeometry (100 , 100 , 500 , 500 )
678
697
window .show ()
679
698
sys .exit (app .exec_ ())
680
699
681
700
682
701
if __name__ == '__main__' :
683
- main ()
702
+ main ()
0 commit comments