mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Created start_client.py and moved server_proxy.py to server directory
This commit is contained in:
@@ -8,8 +8,9 @@ import socket
|
||||
import os, sys
|
||||
from tkinter import ttk, messagebox
|
||||
from PIL import Image, ImageTk
|
||||
from new_job_window import NewJobWindow
|
||||
from server_proxy import RenderServerProxy
|
||||
from lib.client.new_job_window import NewJobWindow
|
||||
from lib.server.server_proxy import RenderServerProxy
|
||||
|
||||
sys.path.append("../")
|
||||
from lib.server.zeroconf_server import ZeroconfServer
|
||||
|
||||
@@ -42,7 +43,9 @@ def available_servers():
|
||||
|
||||
class ZordonClient:
|
||||
|
||||
default_image = Image.open("../server/static/images/desktop.png")
|
||||
lib_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
image_path = os.path.join(lib_path, 'server', 'static', 'images', 'desktop.png')
|
||||
default_image = Image.open(image_path)
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -239,6 +242,7 @@ class ZordonClient:
|
||||
if values[0] == id:
|
||||
tree.item(item, values=new_values, tags=tags)
|
||||
break
|
||||
|
||||
job_fetch = self.server_proxy.get_jobs()
|
||||
if job_fetch is not None:
|
||||
if len(job_fetch) < len(self.job_cache) or len(job_fetch) == 0:
|
||||
@@ -246,7 +250,7 @@ class ZordonClient:
|
||||
self.job_cache = job_fetch # update the cache only if its good data
|
||||
for job in self.job_cache:
|
||||
display_status = job['status'] if job['status'] != 'running' else \
|
||||
('%.0f%%' % (job['percent_complete'] * 100)) # if running, show percentage, otherwise just show status
|
||||
('%.0f%%' % (job['percent_complete'] * 100)) # if running, show percent, otherwise just show status
|
||||
tags = (job['status'],)
|
||||
values = (job['id'],
|
||||
job['name'] or os.path.basename(job['input_path']),
|
||||
@@ -279,6 +283,10 @@ class ZordonClient:
|
||||
x.pack()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def start_client():
|
||||
x = ZordonClient()
|
||||
x.mainloop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
start_client()
|
||||
|
||||
Reference in New Issue
Block a user