Qt6 pour GNU/Linux et wxPython pour Windows

This commit is contained in:
Philippe Roy 2023-01-30 06:36:11 +00:00
parent 22b4853344
commit c0084794c3
2 changed files with 15 additions and 8 deletions

View File

@ -453,7 +453,7 @@ def manip(cont):
# Zoom
##
def manip_wheel(cont):
def manip_wheel(cont):
obj = cont.owner
sensibilite_wheel = 20
if cont.sensors['WheelUp'].positive:
@ -473,7 +473,11 @@ def file_open():
scene.objects['System']['file_proc'].terminate()
# Démarrer le processus file
scene.objects['System']['file_proc'] = subprocess.Popen([sys.executable, os.path.join(os.getcwd(), "twin_file_qt.py")], stdout=subprocess.PIPE, encoding = 'utf8')
if sys.platform=="linux": # wxPython ne s'installe pas bien sur GNU/linux -> Qt6
scene.objects['System']['file_proc'] = subprocess.Popen([sys.executable, os.path.join(os.getcwd(), "twin_file_qt.py")], stdout=subprocess.PIPE, encoding = 'utf8')
else: # Qt6 ne s'installe pas bien sur Windows -> wxPython
scene.objects['System']['file_proc'] = subprocess.Popen([sys.executable, os.path.join(os.getcwd(), "twin_file_wx.py")], stdout=subprocess.PIPE, encoding = 'utf8')
stout = scene.objects['System']['file_proc'].communicate()
if stout[0][:-1] != 'None':
scene.objects['System']['script'] = stout[0][:-1]

View File

@ -86,7 +86,7 @@ def localize_floats(row):
# Génération du fichier
##
def csv_generate():
def csv_generate():
scene.objects['System']['daq']=False
fichier_csv=os.path.join(os.path.split((scene.objects['System']['script']))[0], scene.objects['System']['system']+'.csv')
scene.objects['Cmd-text']['modal']= True
@ -105,7 +105,7 @@ def csv_generate():
# Création du fichier twin_plot.xml (configuration du graphique)
##
def plot_config_generate(data_groups):
def plot_config_generate(data_groups):
# Création du XML
daq_config_list=list(daq_config)
@ -150,7 +150,7 @@ def plot_config_generate(data_groups):
# Activation du mode Plot
##
def plot(data_groups):
def plot(data_groups):
plot_config_generate(data_groups)
scene.objects['System']['plot']=True
@ -159,11 +159,14 @@ def plot(data_groups):
# Threading -> reste actif après le Stop
##
def plot_generate_thread(csv_file):
command = sys.executable + " " + os.path.join(sys.executable, os.getcwd(), "twin_plot_qt.py") + " "+ csv_file
def plot_generate_thread(csv_file):
if sys.platform=="linux": # wxPython ne s'installe pas bien sur GNU/linux -> Qt6
command = sys.executable + " " + os.path.join(sys.executable, os.getcwd(), "twin_plot_qt.py") + " "+ csv_file
else: # Qt6 ne s'installe pas bien sur Windows -> wxPython
command = sys.executable + " " + os.path.join(sys.executable, os.getcwd(), "twin_plot_wx.py") + " "+ csv_file
os.system(command)
def plot_generate(threads):
def plot_generate(threads):
csv_file=os.path.join(os.path.split((scene.objects['System']['script']))[0], scene.objects['System']['system']+'.csv')
threads.append(threading.Thread(target=plot_generate_thread, args=(csv_file,)))
threads[len(threads)-1].start()