update: disabeld button on multiple windows

This commit is contained in:
John 2026-01-29 00:17:06 +01:00
parent d1346e4238
commit b601a51b98
3 changed files with 40 additions and 4 deletions

View file

@ -1459,11 +1459,13 @@ class MenuPage(Page):
self.button_states = {} self.button_states = {}
self.is_system_connected = False self.is_system_connected = False
self.profile_button_map = {} self.profile_button_map = {}
self.p2p_processes = {}
self.font_style = f"font-family: '{main_window.open_sans_family}';" if main_window.open_sans_family else "" self.font_style = f"font-family: '{main_window.open_sans_family}';" if main_window.open_sans_family else ""
# self.label.setStyleSheet("background-color: rgba(0, 255, 0, 51);")
# Establecer el color de fondo y el color del texto utilizando hojas de estilo
self.create_interface_elements() self.create_interface_elements()
self.p2p_timer = QTimer(self)
self.p2p_timer.timeout.connect(self.update_p2p_button_status)
self.p2p_timer.start(1000)
def showEvent(self, event): def showEvent(self, event):
super().showEvent(event) super().showEvent(event)
@ -1564,11 +1566,24 @@ class MenuPage(Page):
def request_func(self): def request_func(self):
if hasattr(self, 'reverse_id'): if hasattr(self, 'reverse_id'):
profile_id = self.reverse_id profile_id = self.reverse_id
if profile_id in self.p2p_processes and self.p2p_processes[profile_id].poll() is None:
return
project_root = os.path.dirname( project_root = os.path.dirname(
os.path.dirname(os.path.abspath(__file__))) os.path.dirname(os.path.abspath(__file__)))
script_path = os.path.join( script_path = os.path.join(
project_root, 'SMS-Exchange-Linux-GUI', 'GUI.py') project_root, 'SMS-Exchange-Linux-GUI', 'GUI.py')
subprocess.Popen([sys.executable, script_path, str(profile_id)]) process = subprocess.Popen(
[sys.executable, script_path, str(profile_id)])
self.p2p_processes[profile_id] = process
if hasattr(self, 'request_button'):
self.request_button.setEnabled(False)
def update_p2p_button_status(self):
if hasattr(self, 'reverse_id') and hasattr(self, 'request_button'):
is_running = self.reverse_id in self.p2p_processes and self.p2p_processes[self.reverse_id].poll(
) is None
if self.request_button.isEnabled() == is_running:
self.request_button.setEnabled(not is_running)
def delete_status_update(self, text): def delete_status_update(self, text):
self.update_status.update_status(text) self.update_status.update_status(text)
@ -2014,7 +2029,9 @@ class MenuPage(Page):
profile = self.profile_info.get(profile_name) profile = self.profile_info.get(profile_name)
self.boton_launch.setEnabled(True) self.boton_launch.setEnabled(True)
if hasattr(self, 'request_button'): if hasattr(self, 'request_button'):
self.request_button.setEnabled(True) is_running = self.reverse_id in self.p2p_processes and self.p2p_processes[self.reverse_id].poll(
) is None
self.request_button.setEnabled(not is_running)
self.boton_just.setEnabled(True) self.boton_just.setEnabled(True)
self.boton_just_session.setEnabled(True) self.boton_just_session.setEnabled(True)
self.boton_create.setEnabled(True) self.boton_create.setEnabled(True)

19
requirements.txt Normal file
View file

@ -0,0 +1,19 @@
aiohappyeyeballs==2.6.1
aiohttp==3.13.3
aiosignal==1.4.0
asyncio==4.0.0
attrs==25.4.0
certifi==2026.1.4
charset-normalizer==3.4.4
frozenlist==1.8.0
idna==3.11
multidict==6.7.0
propcache==0.4.1
PyQt6==6.10.2
PyQt6-Qt6==6.10.1
PyQt6_sip==13.11.0
qasync==0.28.0
requests==2.32.5
typing_extensions==4.15.0
urllib3==2.6.3
yarl==1.22.0