Cards size depending on OS
This commit is contained in:
parent
8e9d74652d
commit
557ee221d5
@ -9,7 +9,7 @@ import requests
|
||||
|
||||
from classes.custom.themed_frame import ThemedFrame
|
||||
from modules.logger import logger
|
||||
from modules.utils import configGet, configSet
|
||||
from modules.utils import configGet, configSet, osname
|
||||
|
||||
|
||||
class FrameDevice(ThemedFrame):
|
||||
@ -18,17 +18,19 @@ class FrameDevice(ThemedFrame):
|
||||
|
||||
super().__init__(master, style="Card.TFrame", **kwargs)
|
||||
|
||||
self.widget_width = 47 if osname == "nt" else 42
|
||||
|
||||
self.grid_columnconfigure(0, weight=1)
|
||||
self.grid_columnconfigure(1, weight=3)
|
||||
self.grid_columnconfigure(2, weight=3)
|
||||
|
||||
self.name = device_dict["name"]
|
||||
|
||||
self.title = ttk.Label(self, text=self.name, font=("SunValleyBodyStrongFont", 12, "bold"), justify=LEFT, width=46)
|
||||
self.title = ttk.Label(self, text=self.name, font=("SunValleyBodyStrongFont", 12, "bold"), justify=LEFT, width=self.widget_width)
|
||||
self.title.grid(column=0, row=0, padx=9, pady=9, sticky=W)
|
||||
|
||||
last_upload = "N/A" if device_dict["last_save"] == 0 else datetime.utcfromtimestamp(device_dict["last_save"]).strftime("%d.%m.%Y %H:%M")
|
||||
self.description = ttk.Label(self, text=f'OS: {device_dict["os"]}\nClient: {device_dict["client"]}\nLast upload: {last_upload}', width=46)
|
||||
self.description = ttk.Label(self, text=f'OS: {device_dict["os"]}\nClient: {device_dict["client"]}\nLast upload: {last_upload}', width=self.widget_width)
|
||||
self.description.grid(column=0, row=1, padx=9, pady=9, sticky=W)
|
||||
|
||||
self.buttons = ThemedFrame(self)
|
||||
@ -94,7 +96,7 @@ class FrameDevice(ThemedFrame):
|
||||
if isinstance(widget, ttk.Entry):
|
||||
widget.destroy()
|
||||
|
||||
device_title = ttk.Label(self, text=self.name, font=("SunValleyBodyStrongFont", 12, "bold"), justify=LEFT, width=46)
|
||||
device_title = ttk.Label(self, text=self.name, font=("SunValleyBodyStrongFont", 12, "bold"), justify=LEFT, width=self.widget_width)
|
||||
device_title.grid(column=0, row=0, padx=9, pady=9, sticky=W)
|
||||
|
||||
button_device_rename_action = partial(self.rename)
|
||||
@ -117,7 +119,7 @@ class FrameDevice(ThemedFrame):
|
||||
if isinstance(widget, ttk.Entry):
|
||||
widget.destroy()
|
||||
|
||||
device_title = ttk.Label(self, text=self.name, font=("SunValleyBodyStrongFont", 12, "bold"), justify=LEFT, width=46)
|
||||
device_title = ttk.Label(self, text=self.name, font=("SunValleyBodyStrongFont", 12, "bold"), justify=LEFT, width=self.widget_width)
|
||||
device_title.grid(column=0, row=0, padx=9, pady=9, sticky=W)
|
||||
|
||||
button_device_rename_action = partial(self.rename)
|
||||
|
@ -2,6 +2,7 @@ from datetime import datetime, timezone
|
||||
from tkinter import LEFT, NSEW, Misc, S, W, ttk
|
||||
|
||||
from classes.custom.themed_frame import ThemedFrame
|
||||
from modules.utils import osname
|
||||
|
||||
|
||||
class FrameSave(ThemedFrame):
|
||||
@ -10,14 +11,16 @@ class FrameSave(ThemedFrame):
|
||||
|
||||
super().__init__(master, style="Card.TFrame", **kwargs)
|
||||
|
||||
self.widget_width = 47 if osname == "nt" else 42
|
||||
|
||||
self.grid_columnconfigure(0, weight=1)
|
||||
self.grid_columnconfigure(1, weight=3)
|
||||
self.grid_columnconfigure(2, weight=3)
|
||||
|
||||
self.title = ttk.Label(self, text=save_dict["data"]["farmer"], font=("SunValleyBodyStrongFont", 12, "bold"), justify=LEFT, width=46)
|
||||
self.title = ttk.Label(self, text=save_dict["data"]["farmer"], font=("SunValleyBodyStrongFont", 12, "bold"), justify=LEFT, width=self.widget_width)
|
||||
self.title.grid(column=0, row=0, padx=9, pady=9, sticky=W)
|
||||
|
||||
self.description = ttk.Label(self, text=f'Money: {save_dict["data"]["money"]}\nGame version: {save_dict["data"]["game_version"]}\nID: {save_dict["id"]}', width=46)
|
||||
self.description = ttk.Label(self, text=f'Money: {save_dict["data"]["money"]}\nGame version: {save_dict["data"]["game_version"]}\nID: {save_dict["id"]}', width=self.widget_width)
|
||||
self.description.grid(column=0, row=1, padx=9, pady=9, sticky=W)
|
||||
|
||||
self.buttons = ThemedFrame(self)
|
||||
@ -25,7 +28,7 @@ class FrameSave(ThemedFrame):
|
||||
self.buttons.grid_columnconfigure(0, weight=1)
|
||||
|
||||
upload_date = datetime.utcfromtimestamp(save_dict["date"]).replace(tzinfo=timezone.utc).astimezone(tz=None)
|
||||
self.last_upload = ttk.Label(self.buttons, text=f'{upload_date.strftime("%A, %d %b %Y")}\nUploaded at {upload_date.strftime("%H:%M")} by {save_dict["device"]}', font=("SunValleyBodyFont", 8), justify=LEFT, width=46)
|
||||
self.last_upload = ttk.Label(self.buttons, text=f'{upload_date.strftime("%A, %d %b %Y")}\nUploaded at {upload_date.strftime("%H:%M")} by {save_dict["device"]}', font=("SunValleyBodyFont", 8), justify=LEFT, width=self.widget_width)
|
||||
self.last_upload.grid(column=0, row=0, sticky=W+S)
|
||||
|
||||
# self.button_device_rename_action = partial(self.rename)
|
||||
@ -35,3 +38,9 @@ class FrameSave(ThemedFrame):
|
||||
#self.button_device_delete_action = partial(self.delete)
|
||||
self.button_device_delete = ttk.Button(self.buttons, text="Synchronize", style="Accent.TButton", width=11) #, command=self.button_device_delete_action)
|
||||
self.button_device_delete.grid(column=1, row=0, sticky=W)
|
||||
|
||||
def convert_date(self, year: int, month: int, day: int) -> str:
|
||||
pass
|
||||
|
||||
def convert_playtime(self, seconds: int) -> str:
|
||||
pass
|
Loading…
Reference in New Issue
Block a user