From fc60d99a65ab80b2fd649aaeb1648e7d98bf391d Mon Sep 17 00:00:00 2001 From: jpattWPC Date: Thu, 10 Mar 2022 16:58:24 -0600 Subject: [PATCH] Add support for INI debug In order to troubleshoot spice connection issues, add ini debug option --- dist/vdiclient.json | 2 +- requirements.bat | 3 ++- vdiclient.ini.example | 2 ++ vdiclient.py | 19 ++++++++++++++++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/dist/vdiclient.json b/dist/vdiclient.json index f70834f..3b2bf28 100644 --- a/dist/vdiclient.json +++ b/dist/vdiclient.json @@ -1,6 +1,6 @@ { "upgrade_guid" : "46cbad92-353e-4b28-9bee-83950991dad8", - "version" : "1.0.0", + "version" : "1.0.1", "product_name" : "VDI Client", "manufacturer" : "Josh Patten", "name" : "VDI Client", diff --git a/requirements.bat b/requirements.bat index 703a4a0..cd23ad0 100644 --- a/requirements.bat +++ b/requirements.bat @@ -1,4 +1,5 @@ @echo off pip install pyinstaller pip install proxmoxer -pip install PySimpleGUIQt \ No newline at end of file +pip install PySimpleGUIQt +pip install requests \ No newline at end of file diff --git a/vdiclient.ini.example b/vdiclient.ini.example index bf9ac0d..44a8780 100644 --- a/vdiclient.ini.example +++ b/vdiclient.ini.example @@ -9,6 +9,8 @@ icon = vdiicon.ico logo = vdiclient.png # Enable Kiosk mode, which does not allow the user to close anything kiosk = False +# Enable displaying SPICE ini file before opening virt-viewer +inidebug = False [Authentication] # This is the authentication backend that will be used to authenticate diff --git a/vdiclient.py b/vdiclient.py index 6fb8a36..bdf8825 100644 --- a/vdiclient.py +++ b/vdiclient.py @@ -27,6 +27,7 @@ class G: kiosk = False verify_ssl = True icon = None + inidebug = False theme = 'LightBlue' sg.theme(G.theme) @@ -78,6 +79,8 @@ def loadconfig(config_location = None): G.imagefile = config['General']['logo'] if 'kiosk' in config['General']: G.kiosk = config['General'].getboolean('kiosk') + if 'inidebug' in config['General']: + G.inidebug = config['General'].getboolean('inidebug') if not 'Authentication' in config: win_popup_button(f'Unable to read supplied configuration:\nNo `Authentication` section defined!', 'OK') return False @@ -170,6 +173,18 @@ def setvmlayout(vms): layout.append([sg.Button('Logout', font=["Helvetica", 14])]) return layout +def iniwin(inistring): + inilayout = [ + [sg.Multiline(default_text=inistring, size=(800, 600))] + ] + iniwindow = sg.Window('INI debug', inilayout) + while True: + event, values = iniwindow.read() + if event == None: + break + iniwindow.close() + return True + def vmaction(vmnode, vmid, vmtype): status = False if vmtype == 'qemu': @@ -206,7 +221,6 @@ def vmaction(vmnode, vmid, vmtype): if startpop: startpop.close() return status - connpop = win_popup(f'Connecting to {vmstatus["name"]}...') if vmtype == 'qemu': spiceconfig = G.proxmox.nodes(vmnode).qemu(str(vmid)).spiceproxy.post() else: # Not sure this is even a thing, but here it is... @@ -226,6 +240,9 @@ def vmaction(vmnode, vmid, vmtype): confignode.write(inifile) inifile.seek(0) inistring = inifile.read() + if G.inidebug: + closed = iniwin(inistring) + connpop = win_popup(f'Connecting to {vmstatus["name"]}...') pcmd = [G.vvcmd] if G.kiosk: pcmd.append('--kiosk')