Procházet zdrojové kódy

1、修正声音默认按钮的问题。
2、有声按钮调用sound_init.py脚本;

scbc.sat2 před 5 roky
rodič
revize
bcc9e2c8a8

+ 29 - 4
SATHelper/SATHelper/MainFrm.cpp

@@ -852,6 +852,15 @@ void CMainFrame::ReadRsRunCfg(RsRunCfg& rscfg)
 
 	GetPrivateProfileString(_T("Sound"), _T("sound_list"), NULL, szValue, MAX_PATH, m_szRsCfgPath);
 	rscfg.sound_list = szValue;
+	int pos1(0), pos2(0);
+	pos1 = rscfg.sound_list.find_first_of('[');
+	pos2 = rscfg.sound_list.find_first_of(',');
+	if (pos1 != std::string::npos && pos2 != std::string::npos)
+	{
+		rscfg.sound1 = rscfg.sound_list.substr(pos1 + 1, pos2 - pos1 - 1);
+		rscfg.sound2 = rscfg.sound_list.substr(pos2 + 1, rscfg.sound_list.length() - pos2 - 2);
+	}
+	 
 
 	GetPrivateProfileString(_T("COMM"), _T("issendkeytakepicture_tester"), NULL, szValue, MAX_PATH, m_szRsCfgPath);
 	rscfg.full_cut = szValue;
@@ -1153,7 +1162,7 @@ void CMainFrame::InitDevicePanel()
 	CMFCRibbonEdit* pSoundLevel = DYNAMIC_DOWNCAST(CMFCRibbonEdit, pRibbon->FindByID(ID_EDIT_SOUND_LEVEL));
 	if (pSoundLevel)
 	{
-		pSoundLevel->SetEditText(m_bdcfg.reset_time.c_str());
+		pSoundLevel->SetEditText(m_rscfg.sound1.c_str());
 	}
 
 	// 全步骤截图;
@@ -1224,17 +1233,18 @@ void CMainFrame::OnHadSound()
 	std::thread t([&]() {
 		// 强制stdion, stdout和stderr完全无缓冲:python -u
 		TCHAR szCommandLine[MAX_PATH] = { 0 };
-		_stprintf_s(szCommandLine, _T("python -W ignore -u \"%s%s\""), Global::g_szPython27Dir, _T("Lib\\site-packages\\ssat_sdk\\sound_init.py"));
+		_stprintf_s(szCommandLine, _T("python -W ignore \"%s%s\" >>%ssound_log.txt"), Global::g_szPython27Dir, _T("Lib\\site-packages\\ssat_sdk\\sound_init.py"), Global::g_szCurModuleDir);
 		WinExec(szCommandLine, SW_HIDE);
+		OutputDebugString(szCommandLine);
 		// 等待10秒;
-		Sleep(15000);
+		Sleep(30000);
 		ReadRsRunCfg(m_rscfg);
 		// Ribbon Combobox添加默认项;
 		CMFCRibbonBar* pRibbon = g_pMainFrame->GetRibbonBar();
 		CMFCRibbonEdit* pSoundLevel = DYNAMIC_DOWNCAST(CMFCRibbonEdit, pRibbon->FindByID(ID_EDIT_SOUND_LEVEL));
 		if (pSoundLevel)
 		{
-			pSoundLevel->SetEditText(m_bdcfg.reset_time.c_str());
+			pSoundLevel->SetEditText(m_rscfg.sound1.c_str());
 		}
 	});
 	t.detach();
@@ -1251,6 +1261,21 @@ void CMainFrame::OnUpdateHadSound(CCmdUI* pCmdUI)
 void CMainFrame::OnDefSound()
 {
 	// TODO: 在此添加命令处理程序代码
+	TCHAR szValue[MAX_PATH] = { 0 };
+	TCHAR szBuffer[1024] = { 0 };
+	_stprintf_s(m_szRsCfgPath, _T("%s%s"), Global::g_szPython27Dir, _T("Lib\\site-packages\\ssat_sdk\\config\\resource_run.cfg"));
+	WritePrivateProfileString(_T("Sound"), _T("sound_list"), _T("[2000,2000]"), m_szRsCfgPath);
+	// Ribbon Combobox添加默认项;
+	m_rscfg.sound1 = _T("2000");
+	m_rscfg.sound2 = _T("2000");
+	m_rscfg.sound_list = _T("[2000,2000]");
+	CMFCRibbonBar* pRibbon = g_pMainFrame->GetRibbonBar();
+	CMFCRibbonEdit* pSoundLevel = DYNAMIC_DOWNCAST(CMFCRibbonEdit, pRibbon->FindByID(ID_EDIT_SOUND_LEVEL));
+	if (pSoundLevel)
+	{
+		pSoundLevel->SetEditText(m_rscfg.sound1.c_str());
+	}
+	
 }
 
 

+ 2 - 0
SATHelper/SATHelper/MainFrm.h

@@ -203,6 +203,8 @@ public:
 	typedef struct __RS_RUN_CFG__
 	{
 		std::string sound_list;	// 声音级别;
+		std::string sound1;
+		std::string sound2;
 		std::string full_cut;	// 是否全步骤截图;('True/False')
 		//....
 		std::string tg39_port;

+ 5 - 4
SATHelper/SATHelper/Resource.h

@@ -169,25 +169,26 @@
 #define ID_COMBO2_22293                 32803
 #define ID_CHECK2_22293                 32804
 #define ID_COMBO_TVPORT                 32805
-#define ID_COMBO_TWPORT                 32811
 #define ID_COMBO1_22293                 32806
 #define ID_CHECK1_22293                 32807
+#define ID_CHECK_WATCHTV                32809
+#define ID_CHECK_ENABLETW               32810
+#define ID_COMBO_TWPORT                 32811
 #define ID_CHECK_SHOT_SPEC              32818
 #define ID_CHECK_SHOT_LOCAL             32819
 #define ID_CHECK_SHOT_SYSTEM            32820
 #define ID_CHECK_IR_SHOT                32823
 #define ID_CHECK2                       32824
-#define ID_CHECK_WATCHTV                32809
-#define ID_CHECK_ENABLETW               32810
 #define ID_TRAYMENU_LOGIN               32825
 #define ID_BUTTON2                      32827
+#define ID_CHECK_LINEIN                 32828
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        326
-#define _APS_NEXT_COMMAND_VALUE         32828
+#define _APS_NEXT_COMMAND_VALUE         32829
 #define _APS_NEXT_CONTROL_VALUE         1015
 #define _APS_NEXT_SYMED_VALUE           310
 #endif

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
SATHelper/SATHelper/SATHelper.rc


+ 2 - 2
SATHelper/SATHelper/res/ribbon.mfcribbon-ms

@@ -584,8 +584,8 @@
                             <ELEMENT>
                                 <ELEMENT_NAME>Button_Check</ELEMENT_NAME>
                                 <ID>
-                                    <NAME>ID_EDIT_SOUND_LEVEL</NAME>
-                                    <VALUE>32780</VALUE>
+                                    <NAME>ID_CHECK_LINEIN</NAME>
+                                    <VALUE>32828</VALUE>
                                 </ID>
                                 <TEXT>Line-IN</TEXT>
                                 <PALETTE_TOP>FALSE</PALETTE_TOP>

+ 5 - 4
SATHelper/SATHelper/resource.h

@@ -169,25 +169,26 @@
 #define ID_COMBO2_22293                 32803
 #define ID_CHECK2_22293                 32804
 #define ID_COMBO_TVPORT                 32805
-#define ID_COMBO_TWPORT                 32811
 #define ID_COMBO1_22293                 32806
 #define ID_CHECK1_22293                 32807
+#define ID_CHECK_WATCHTV                32809
+#define ID_CHECK_ENABLETW               32810
+#define ID_COMBO_TWPORT                 32811
 #define ID_CHECK_SHOT_SPEC              32818
 #define ID_CHECK_SHOT_LOCAL             32819
 #define ID_CHECK_SHOT_SYSTEM            32820
 #define ID_CHECK_IR_SHOT                32823
 #define ID_CHECK2                       32824
-#define ID_CHECK_WATCHTV                32809
-#define ID_CHECK_ENABLETW               32810
 #define ID_TRAYMENU_LOGIN               32825
 #define ID_BUTTON2                      32827
+#define ID_CHECK_LINEIN                 32828
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        326
-#define _APS_NEXT_COMMAND_VALUE         32828
+#define _APS_NEXT_COMMAND_VALUE         32829
 #define _APS_NEXT_CONTROL_VALUE         1015
 #define _APS_NEXT_SYMED_VALUE           310
 #endif

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů