Update vdiclient.py

Fix TKinter integer requirement
This commit is contained in:
jpattWPC 2022-04-21 11:27:23 -05:00
parent 2368e7c4a5
commit fe11d33359

View File

@ -2,8 +2,10 @@
import proxmoxer # pip install proxmoxer import proxmoxer # pip install proxmoxer
try: try:
import PySimpleGUIQt as sg # pip install PySimpleGUIQt import PySimpleGUIQt as sg # pip install PySimpleGUIQt
gui = 'QT'
except ImportError: except ImportError:
import PySimpleGUI as sg # pip install PySimpleGUI import PySimpleGUI as sg # pip install PySimpleGUI
gui = 'TK'
import requests import requests
from configparser import ConfigParser from configparser import ConfigParser
import random import random
@ -135,6 +137,7 @@ def loadconfig(config_location = None):
def win_popup(message): def win_popup(message):
layout = [[sg.Text(message)]] layout = [[sg.Text(message)]]
window = sg.Window('Message', layout, no_titlebar=True, keep_on_top=True, finalize=True) window = sg.Window('Message', layout, no_titlebar=True, keep_on_top=True, finalize=True)
window.bring_to_front()
return window return window
def win_popup_button(message, button): def win_popup_button(message, button):
@ -395,10 +398,13 @@ def showvms():
return True return True
def main(): def main():
if os.name == 'nt': if os.name == 'nt' and gui == 'QT':
G.scaling = get_dpi() G.scaling = get_dpi()
else: else:
G.scaling = 1.0 #TODO FIXME: Figure out scaling on Linux if gui == 'QT':
G.scaling = 1.0 #TODO FIXME: Figure out scaling on Linux
else:
G.scaling = 1 # TKinter requires integers
config_location = None config_location = None
if len(sys.argv) > 1: if len(sys.argv) > 1:
if sys.argv[1] == '--list_themes': if sys.argv[1] == '--list_themes':