Skip to content

Commit 5f131e1

Browse files
committed
add option to disable another script is running popup warning
1 parent 70f1c87 commit 5f131e1

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

PythonScript/res/PythonScript.rc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
2525
// TEXTINCLUDE
2626
//
2727

28-
1 TEXTINCLUDE
28+
1 TEXTINCLUDE
2929
BEGIN
3030
"resource.h\0"
3131
END
3232

33-
2 TEXTINCLUDE
33+
2 TEXTINCLUDE
3434
BEGIN
3535
"#include ""afxres.h""\r\n"
3636
"\0"
3737
END
3838

39-
3 TEXTINCLUDE
39+
3 TEXTINCLUDE
4040
BEGIN
4141
"\r\n"
4242
"\0"
@@ -70,16 +70,16 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
7070
BEGIN
7171
PUSHBUTTON "Run",IDC_RUN,152,156,40,13
7272
LTEXT ">>>",IDC_PROMPT,7,158,17,11
73-
COMBOBOX IDC_COMBO1,25,156,125,50,CBS_DROPDOWN | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
73+
COMBOBOX IDC_COMBO1,25,156,125,50,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
7474
END
7575

76-
IDD_SCRIPTCONFIG DIALOGEX 0, 0, 377, 404
76+
IDD_SCRIPTCONFIG DIALOGEX 0, 0, 377, 412
7777
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
7878
CAPTION "Python Script Configuration"
7979
FONT 8, "MS Shell Dlg", 400, 0, 0x1
8080
BEGIN
81-
DEFPUSHBUTTON "OK",IDOK,265,383,50,14
82-
PUSHBUTTON "Cancel",IDCANCEL,320,383,50,14
81+
DEFPUSHBUTTON "OK",IDOK,265,391,50,14
82+
PUSHBUTTON "Cancel",IDCANCEL,320,391,50,14
8383
CONTROL "",IDC_FILETREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,14,31,343,105
8484
GROUPBOX "Scripts",IDC_STATIC,7,7,363,136
8585
CONTROL "Machine Scripts",IDC_RADMACHINE,"Button",BS_AUTORADIOBUTTON,19,18,65,10
@@ -106,6 +106,8 @@ BEGIN
106106
CONTROL "Color output from run statements differently",IDC_CHECKCOLORIZEOUTPUT,
107107
"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | BS_NOTIFY | WS_TABSTOP,11,370,157,10
108108
PUSHBUTTON "Choose a color...",IDC_COLORCHOOSER,169,367,65,14
109+
CONTROL "DISABLE another script is running popup warning",IDC_DISABLEPOPUPWARNING,
110+
"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | BS_NOTIFY | WS_TABSTOP,11,384,170,10
109111
END
110112

111113
IDD_PROMPTDIALOG DIALOGEX 0, 0, 313, 105
@@ -149,7 +151,7 @@ BEGIN
149151
LEFTMARGIN, 7
150152
RIGHTMARGIN, 370
151153
TOPMARGIN, 7
152-
BOTTOMMARGIN, 397
154+
BOTTOMMARGIN, 405
153155
END
154156

155157
IDD_PROMPTDIALOG, DIALOG

PythonScript/res/resource.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define IDI_ICON1 114
1717
#define IDD_PROMPTDIALOG 116
1818
#define IDB_PYTHONPOWERED 118
19-
#define IDC_COMBO1 1001
19+
#define IDC_COMBO1 1001
2020
#define IDC_RUN 1002
2121
#define IDC_PROMPT 1003
2222
#define IDC_FILETREE 1004
@@ -42,7 +42,7 @@
4242
#define IDC_CHECKOPENCONSOLEONERROR 1022
4343
#define IDC_CHECKCOLORIZEOUTPUT 1023
4444
#define IDC_COLORCHOOSER 1024
45-
45+
#define IDC_DISABLEPOPUPWARNING 1025
4646

4747
// Next default values for new objects
4848
//

PythonScript/src/ConfigFile.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void ConfigFile::initSettings()
4646
setSetting(_T("ADDEXTRALINETOOUTPUT"), _T("0"));
4747
setSetting(_T("COLORIZEOUTPUT"), _T("-1"));
4848
setSetting(_T("OPENCONSOLEONERROR"), _T("1"));
49+
setSetting(_T("DISABLEPOPUPWARNING"), _T("0"));
4950
setSetting(_T("PREFERINSTALLEDPYTHON"), _T("0"));
5051
setSetting(_T("STARTUP"), _T("LAZY"));
5152
}

PythonScript/src/PythonScript.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,10 @@ static void runStatement(const TCHAR *statement, bool synchronous, HANDLE comple
506506
MenuManager::getInstance()->stopScriptEnabled(true);
507507
if (!pythonHandler->runScript(statement, synchronous, allowQueuing, completedEvent, true))
508508
{
509-
MessageBox(NULL, _T("Another script is currently running. Running two scripts at the same time could produce unpredicable results, and is therefore disabled."), PLUGIN_NAME, 0);
509+
if (ConfigFile::getInstance()->getSetting(_T("DISABLEPOPUPWARNING")) == _T("0"))
510+
{
511+
MessageBox(NULL, _T("Another script is currently running. Running two scripts at the same time could produce unpredicable results, and is therefore disabled."), PLUGIN_NAME, 0);
512+
}
510513
}
511514

512515
}
@@ -559,7 +562,10 @@ static void runScript(const TCHAR *filename, bool synchronous, HANDLE completedE
559562

560563
if (!pythonHandler->runScript(filename, synchronous, allowQueuing, completedEvent))
561564
{
562-
MessageBox(NULL, _T("Another script is currently running. Running two scripts at the same time could produce unpredicable results, and is therefore disabled."), PLUGIN_NAME, 0);
565+
if (ConfigFile::getInstance()->getSetting(_T("DISABLEPOPUPWARNING")) == _T("0"))
566+
{
567+
MessageBox(NULL, _T("Another script is currently running. Running two scripts at the same time could produce unpredicable results, and is therefore disabled."), PLUGIN_NAME, 0);
568+
}
563569
}
564570
}
565571

PythonScript/src/ShortcutDlg.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,9 @@ void ShortcutDlg::populateCurrentItems()
529529

530530
bool openOnError = (configFile->getSetting(_T("OPENCONSOLEONERROR")) == _T("1"));
531531
CheckDlgButton(_hSelf, IDC_CHECKOPENCONSOLEONERROR, openOnError ? BST_CHECKED : BST_UNCHECKED);
532+
533+
bool disablePopupWarning = (configFile->getSetting(_T("DISABLEPOPUPWARNING")) == _T("1"));
534+
CheckDlgButton(_hSelf, IDC_DISABLEPOPUPWARNING, disablePopupWarning ? BST_CHECKED : BST_UNCHECKED);
532535

533536
}
534537

@@ -566,6 +569,9 @@ void ShortcutDlg::saveConfig()
566569

567570
bool openOnError = (BST_CHECKED == IsDlgButtonChecked(_hSelf, IDC_CHECKOPENCONSOLEONERROR));
568571
configFile->setSetting(_T("OPENCONSOLEONERROR"), openOnError ? _T("1") : _T("0"));
572+
573+
bool disablePopupWarning = (BST_CHECKED == IsDlgButtonChecked(_hSelf, IDC_DISABLEPOPUPWARNING));
574+
configFile->setSetting(_T("DISABLEPOPUPWARNING"), disablePopupWarning ? _T("1") : _T("0"));
569575

570576
configFile->save();
571577
}

0 commit comments

Comments
 (0)