1818from src .putting_settings import PuttingSettings
1919from src .settings import Settings , LaunchMonitor , Simulator
2020from src .PuttingForm import PuttingForm
21- from src .gspro_connection import GSProConnection
22- from src .ogs_connection import OpenGolfSimConnection
21+ from src .sim_connection import SimConnection
22+ # from src.gspro_connection import GSProConnection
23+ # from src.ogs_connection import OpenGolfSimConnection
2324from src .device_launch_monitor_screenshot import DeviceLaunchMonitorScreenshot
2425from src .putting import Putting
2526
@@ -32,8 +33,8 @@ class LogTableCols:
3233
3334
3435class MainWindow (QMainWindow , Ui_MainWindow ):
35- version = 'V1.04.22 Beta'
36- app_name = 'MLM2PRO-GSPro -Connector'
36+ version = 'V2.0.0 Beta'
37+ app_name = 'MLM2PRO-Universal -Connector'
3738 good_shot_color = '#62ff00'
3839 good_putt_color = '#fbff00'
3940 bad_shot_color = '#ff3800'
@@ -49,8 +50,7 @@ def __init__(self, app):
4950 self .app_paths .setup ()
5051 self .__setup_logging ()
5152 self .settings = Settings (self .app_paths )
52- self .gspro_connection = GSProConnection (self )
53- self .ogs_connection = OpenGolfSimConnection (self )
53+ self .sim_connection = SimConnection (self , simulator_api = self .settings .simulator_api )
5454 self .settings_form = SettingsForm (settings = self .settings , app_paths = self .app_paths )
5555 self .putting_settings = PuttingSettings (self .app_paths )
5656 self .putting_settings_form = PuttingForm (main_window = self )
@@ -88,12 +88,13 @@ def showEvent(self, event: QShowEvent) -> None:
8888
8989 def __setup_ui (self ):
9090 self .__setup_launch_monitor ()
91+ self .sim_group_box .setTitle (f"{ self .settings .simulator_api } Connection" )
9192 self .actionExit .triggered .connect (self .__exit )
9293 self .actionAbout .triggered .connect (self .__about )
9394 self .actionSettings .triggered .connect (self .__settings )
9495 self .actionDonate .triggered .connect (self .__donate )
9596 self .actionShop .triggered .connect (self .__shop )
96- self .gspro_connect_button .clicked .connect (self .__gspro_connect )
97+ self .gspro_connect_button .clicked .connect (self .__sim_connect )
9798 self .main_tab .setCurrentIndex (0 )
9899 #self.log_table.horizontalHeader().setStretchLastSection(True)
99100 self .log_table .setHorizontalHeaderLabels (['Date' , 'Type' , 'System' , 'Message' ])
@@ -129,7 +130,8 @@ def __auto_start(self):
129130 if self .settings .auto_start_all_apps == 'Yes' :
130131 if self .settings .simulator_api == Simulator .GSPRO and len (self .settings .gspro_path ) > 0 and len (self .settings .grspo_window_name ) and os .path .exists (self .settings .gspro_path ):
131132 self .log_message (LogMessageTypes .LOG_WINDOW , LogMessageSystems .CONNECTOR , f'Starting GSPro' )
132- self .gspro_connection .gspro_start (self .settings , True )
133+ self .sim_connection .gspro_start (self .settings , True )
134+ # self.gspro_connection.gspro_start(self.settings, True)
133135 if self .settings .device_id != LaunchMonitor .RELAY_SERVER and \
134136 self .settings .device_id != LaunchMonitor .MLM2PRO_BT and \
135137 self .settings .device_id != LaunchMonitor .R10_BT and \
@@ -189,8 +191,8 @@ def __exit(self):
189191 self .close ()
190192
191193 def closeEvent (self , event : QShowEvent ) -> None :
192- logging .debug (f'{ MainWindow .app_name } Closing gspro connection' )
193- self .gspro_connection .shutdown ()
194+ logging .debug (f'{ MainWindow .app_name } Closing simulator connection' )
195+ self .sim_connection .shutdown ()
194196 logging .debug (f'{ MainWindow .app_name } Closing putting' )
195197 self .putting .shutdown ()
196198 logging .debug (f'{ MainWindow .app_name } Closing launch monitor connection' )
@@ -207,18 +209,11 @@ def __shop(self):
207209 url = "https://cascadia3dpd.com"
208210 webbrowser .open (url , new = 2 ) # 2 = open in new tab
209211
210- def __gspro_connect (self ):
211- if self .settings .simulator_api == Simulator .GSPRO :
212- if self .gspro_connection .connected :
213- self .gspro_connection .disconnect_from_gspro ()
214- else :
215- self .gspro_connection .connect_to_gspro ()
216- elif self .settings .simulator_api == Simulator .OPENGOLFSIM :
217- logging .debug (f'{ MainWindow .app_name } Connecting to OpenGolfSim API...' )
218- if self .ogs_connection .connected :
219- self .ogs_connection .disconnect_from_ogs ()
220- else :
221- self .ogs_connection .connect_to_ogs ()
212+ def __sim_connect (self ):
213+ if self .sim_connection .connected :
214+ self .sim_connection .disconnect_sim ()
215+ else :
216+ self .sim_connection .connect_sim ()
222217
223218
224219 def __about (self ):
0 commit comments