From f509099b5aad80d9f11b4b1e91f142a158a3e711 Mon Sep 17 00:00:00 2001 From: Redcxx Date: Thu, 29 Aug 2019 20:59:35 +0800 Subject: [PATCH] gui ui enchance login page & rank & id done ++ --- gui/common.py | 49 +++++++- gui/download.py | 3 +- gui/factory.py | 50 -------- gui/id.py | 64 +++++----- gui/login.py | 114 ++++++++---------- gui/main.py | 1 - gui/menu.py | 44 +++---- gui/models.py | 285 ++++++++++++++++++++++++++++---------------- gui/pikaxhandler.py | 2 + gui/rank.py | 96 ++++++--------- gui/settings.py | 76 ++++++++++-- 11 files changed, 444 insertions(+), 340 deletions(-) diff --git a/gui/common.py b/gui/common.py index 8bf152e..3829437 100644 --- a/gui/common.py +++ b/gui/common.py @@ -1,18 +1,22 @@ +import glob +import re import sys +import tkinter from multiprocessing import Process from tkinter import END, NORMAL, DISABLED, Text, Entry, TclError -from download import DownloadWindow +import settings def go_to_next_screen(src, dest): pikax_handler = src.pikax_handler master = src.frame.master - src.destroy() dest(master, pikax_handler) + src.destroy() # destroy after creation to prevent black screen in the middle def download(target, args=(), kwargs=()): + from download import DownloadWindow Process(target=DownloadWindow, args=(target, args, kwargs)).start() @@ -63,3 +67,44 @@ def write(self, string): def flush(self): pass + + +def crop_to_dimension(im, width_ratio, height_ratio, focus=tkinter.CENTER): + transformed_width = im.height / height_ratio * width_ratio + if transformed_width < im.width: + width = transformed_width + height = im.height + else: + height = im.width / width_ratio * height_ratio + width = im.width + + mid = list(x / 2 for x in im.size) + half_width = width / 2 + half_height = height / 2 + + if focus == tkinter.CENTER: + mid = mid + elif focus == tkinter.N: + mid[1] = half_height + elif focus == tkinter.S: + mid[1] = im.size[1] - half_height + elif focus == tkinter.W: + mid[0] = half_width + elif focus == tkinter.E: + mid[0] = im.size[0] - half_width + else: + raise ValueError(f'Invalid focus: {focus}') + + left = mid[0] - half_width + upper = mid[1] - half_height + right = mid[0] + half_width + lower = mid[1] + half_height + + return im.crop((left, upper, right, lower)) + + +def get_background_file_path(): + for file in glob.glob(settings.IMAGES_PATH): + if re.search(settings.CANVAS_BACKGROUND_PATH, file): + return file + return None diff --git a/gui/download.py b/gui/download.py index df8facd..d3a7e57 100644 --- a/gui/download.py +++ b/gui/download.py @@ -2,7 +2,6 @@ from threading import Thread import settings -from factory import make_text from models import PikaxGuiComponent @@ -51,7 +50,7 @@ def cancel_clicked(self): self.destroy() def make_download_output(self): - text_area = make_text(self.frame) + text_area = self.make_text() text_area.configure(height=20) return text_area diff --git a/gui/factory.py b/gui/factory.py index 11bd49b..139597f 100644 --- a/gui/factory.py +++ b/gui/factory.py @@ -1,52 +1,2 @@ -from tkinter import * -# image = None -from tkinter import ttk - -def make_button(master, text=''): - # global image - # image = PhotoImage(file='neurons.gif') - return Button(master=master, - text=text, - relief=FLAT, - padx=10, - pady=2, - width=17 - ) - - -def make_label(master, text=''): - return Label(master=master, - text=text) - - -def make_entry(master): - return Entry(master=master, borderwidth=0, highlightthickness=0, justify=CENTER) - - -def make_frame(master): - return Frame(master=master) - - -def make_dropdown(master, default, choices): - dropdown = ttk.Combobox(master, values=choices, state='readonly') - dropdown.configure(width=17) - dropdown.set(default) - return dropdown - - -def make_text(master): - return Text(master, wrap=WORD, height=1, width=80, state=DISABLED, highlightthickness=0, borderwidth=0) - - -def grid(component): - component.grid(padx=5, pady=5) - - -def pack(component): - component.pack(padx=5, pady=5) - - -def button_grid_configure(button): - button.grid_configure(padx=5, pady=5) diff --git a/gui/id.py b/gui/id.py index 7db3956..7e7dab4 100644 --- a/gui/id.py +++ b/gui/id.py @@ -1,37 +1,52 @@ import re import sys from threading import Thread -from tkinter import NORMAL, W, E -from models import PikaxGuiComponent from common import go_to_next_screen +from models import PikaxGuiComponent + + +class IDDownloadThread(Thread): + def __init__(self, output_area, *args, **kwargs): + super().__init__(*args, **kwargs) + self.output_area = output_area + + def run(self): + super().run() + if self.output_area: + self.output_area.see(0.0) class IdScreen(PikaxGuiComponent): def __init__(self, master, pikax_handler): super().__init__(master, pikax_handler) - self.id_or_url_label = self.make_label('Illustration id or url') - self.id_or_url_entry = self.make_entry() - self.id_or_url_entry.configure(width=40) + + self.grid_width = 20 + self.grid_height = 9 + self.id_or_url_text_id = self.add_text(text='Illustration id or url', row=2, column=9, columnspan=2) + + self.id_or_url_entry = self.make_entry(width=40) + self.url_or_entry_id = self.add_widget(widget=self.id_or_url_entry, row=3, column=9, columnspan=2) + + # buttons self.download_button = self.make_button(text='download') - self.download_output = self.make_download_output() - self.back_button = self.make_button('back') + self.download_button_id = self.add_widget(widget=self.download_button, row=4, column=8) + self.back_button = self.make_button(text='back') + self.back_button_id = self.add_widget(widget=self.back_button, row=4, column=11) - self.components = [ - self.id_or_url_label, - self.id_or_url_entry, - self.download_button, - self.download_output - ] + self.download_output = self.make_download_output() + self.download_output_id = self.add_widget(widget=self.download_output, row=6, column=9, columnspan=2) + self.redirect_output_to(self.download_output) self.download_button.configure(command=self.download_clicked) self.back_button.configure(command=self.back_clicked) - self.redirect_output_to(self.download_output) self.download_thread = None - self.load() + self.id_or_url_entry.focus_set() + self.frame.pack_configure(expand=True) + self.pack(self.frame) def back_clicked(self): from menu import MenuScreen @@ -41,7 +56,8 @@ def download_clicked(self): user_input = self.id_or_url_entry.get() search_id = re.search(r'(?', self.login) self.password_entry.bind('', self.login) self.password_entry.configure(show="\u2022") # bullet - for item in entries: - item.configure(bg=self.entry_color, fg=self.text_color, - insertbackground=self.cursor_color, font=self.entry_font) - def login(self, event=None): + @staticmethod + def register_button_pressed(): + webbrowser.open(settings.PIXIV_REGISTER_URL) + + def login(self, _=None): Thread(target=self._login).start() def _login(self): @@ -105,11 +89,13 @@ def _login(self): password = self.password_entry.get().strip() try: self.pikax_handler.login(username, password) - from menu import MenuScreen go_to_next_screen(src=self, dest=MenuScreen) - except PikaxException: + except PikaxException as e: self.login_button.configure(state=NORMAL) - sys.stdout.write('Login Failed') + sys.stdout.write(f'{e}') + + def guest_login(self): + go_to_next_screen(src=self, dest=MenuScreen) def destroy(self): self.frame.destroy() diff --git a/gui/main.py b/gui/main.py index 130b9f3..fa1abf4 100644 --- a/gui/main.py +++ b/gui/main.py @@ -33,4 +33,3 @@ def main(): if __name__ == '__main__': multiprocessing.freeze_support() main() - diff --git a/gui/menu.py b/gui/menu.py index fdecff8..91c7f38 100644 --- a/gui/menu.py +++ b/gui/menu.py @@ -1,4 +1,4 @@ -from factory import make_button, NORMAL, pack +from tkinter import NORMAL from models import PikaxGuiComponent from common import go_to_next_screen @@ -6,23 +6,37 @@ class MenuScreen(PikaxGuiComponent): def __init__(self, master, pikax_handler): super().__init__(master, pikax_handler) - self.search_button = self.make_button(text='Search') - self.search_button.configure(command=self.search_clicked) + + self.grid_height = 10 + self.grid_width = 1 + + # create buttons self.rank_button = self.make_button(text='Rank') - self.rank_button.configure(command=self.rank_clicked) - self.id_button = self.make_button('ID') - self.id_button.configure(command=self.id_clicked) + self.id_button = self.make_button(text='ID') + self.search_button = self.make_button(text='Search') self.back_button = self.make_button(text='Back') - self.back_button.configure(command=self.back_clicked) + + self.rank_button_id = self.add_widget(widget=self.rank_button, row=3) + self.id_button_id = self.add_widget(widget=self.id_button, row=4) + self.search_button_id = self.add_widget(widget=self.search_button, row=5) + self.back_button_id = self.add_widget(widget=self.back_button, row=7) self.buttons = [ - self.search_button, self.rank_button, self.id_button, + self.search_button, self.back_button ] - self.load() + self.config_buttons() + self.frame.pack_configure(expand=True) + self.pack(self.frame) + + def config_buttons(self): + self.search_button.configure(command=self.search_clicked) + self.rank_button.configure(command=self.rank_clicked) + self.id_button.configure(command=self.id_clicked) + self.back_button.configure(command=self.back_clicked) def id_clicked(self): from id import IdScreen @@ -40,18 +54,6 @@ def back_clicked(self): from login import LoginScreen go_to_next_screen(src=self, dest=LoginScreen) - def load(self): - - for button in self.buttons: - self.pack(button) - button.configure(state=NORMAL) - - self.frame.pack_configure(expand=True) - pack(self.frame) - - def destroy(self): - self.frame.destroy() - def main(): from pikaxhandler import PikaxHandler diff --git a/gui/models.py b/gui/models.py index f383488..e25ef52 100644 --- a/gui/models.py +++ b/gui/models.py @@ -1,104 +1,111 @@ +import tkinter as tk +import webbrowser from tkinter import font -import settings -from factory import * - - -class PikaxGuiComponent: - - def __init__(self, master, pikax_handler): - self.master = master - self._frame = Frame(master) - self._frame.configure(borderwidth=0, highlightthickness=0) - self._pikax_handler = pikax_handler - self._width = settings.MAIN_WINDOW_WIDTH - self._height = settings.MAIN_WINDOW_HEIGHT - self._label_font = font.Font(family=settings.DEFAULT_FONT_FAMILY, size=settings.DEFAULT_FONT_SIZE, - weight=font.BOLD) - self._entry_font = font.Font(family=settings.DEFAULT_FONT_FAMILY, size=settings.DEFAULT_FONT_SIZE - 2) - self._button_font = self.entry_font - # subclass must set these - self._grid_height = -1 - self._grid_width = -1 - self.is_grid_width_set = False - self.is_grid_height_set = False - - def destroy(self): - raise NotImplementedError - - @property - def grid_width(self): - if not self.is_grid_width_set: - raise ValueError('grid width is not set') - return self._grid_width - - @grid_width.setter - def grid_width(self, value): - self._grid_width = value - self.is_grid_width_set = True - - @property - def grid_height(self): - if not self.is_grid_height_set: - raise ValueError('grid height is not set') - return self._grid_height - - @grid_height.setter - def grid_height(self, value): - self._grid_height = value - self.is_grid_height_set = True - - @property - def width(self): - return self._width +from PIL import Image, ImageTk - @property - def height(self): - return self._height - - @property - def frame(self): - return self._frame - - @property - def label_font(self): - return self._label_font - - @property - def button_font(self): - return self._button_font +import settings +from common import crop_to_dimension, get_background_file_path - @property - def entry_font(self): - return self._entry_font - @property - def pikax_handler(self): - return self._pikax_handler +class PikaxOptionMenu(tk.OptionMenu): - def make_button(self, text=''): - return make_button(self.frame, text=text) + def __init__(self, master, default, *args, **kwargs): + self.var = tk.StringVar(master) + self.var.set(default) + super().__init__(master, self.var, *args, **kwargs) - def make_label(self, text=''): - return make_label(self.frame, text=text) + def get(self): + return self.var.get().strip() - def make_frame(self): - return make_frame(self.frame) - def make_dropdown(self, default, choices): - return make_dropdown(self.frame, default, choices) +class PikaxGuiComponent: - def make_entry(self): - return make_entry(self.frame) + def __init__(self, master, pikax_handler): + self.master = master + self.frame = self.make_frame(borderwidth=0, highlightthickness=0) + self.pikax_handler = pikax_handler + self.width = settings.MAIN_WINDOW_WIDTH + self.height = settings.MAIN_WINDOW_HEIGHT + + # + # settings + # + + # texts + self.issue_text = 'Report' + self.title_text = settings.TITLE + ' ' + settings.VERSION + + # fonts + self.text_font = font.Font(family=settings.DEFAULT_FONT_FAMILY, size=settings.DEFAULT_FONT_SIZE, + weight=font.BOLD) + self.entry_font = font.Font(family=settings.DEFAULT_FONT_FAMILY, size=settings.DEFAULT_FONT_SIZE - 2) + self.button_font = self.entry_font + self.dropdown_font = self.entry_font + self.output_font = font.Font(family=settings.DEFAULT_FONT_FAMILY, size=settings.DEFAULT_FONT_SIZE - 4) + self.canvas_artist_font = font.Font(family='Courier', size=10) + + # text colors + self.title_color = '#51abc2' + self.display_text_color = '#51abc2' + self.input_text_color = 'white' + self.artist_name_color = '#1b5361' + # button colors + self.button_color = '#1b5361' + self.entry_color = '#1b5361' + self.pressed_button_color = '#0c313b' + self.cursor_color = 'white' + + self.grid_height = self.height + self.grid_width = self.width + + # sizes + self.button_width = 10 + self.title_font_size = 12 + self.dropdown_width = 16 + + # + # default operations + # + + # add canvas background + self.canvas = self.set_canvas(image_path=get_background_file_path(), focus=tk.CENTER) + + # add title + title_font = font.Font(family='Arial', size=self.title_font_size, weight=font.BOLD) + self.canvas_title = self.add_text(text=self.title_text, font=title_font, row=20, column=60, columnspan=2, + color=self.title_color) + # add issue button + self.issue_button = self.make_button(text=self.issue_text) + self.issue_button_id = self.add_widget(widget=self.issue_button, row=self.grid_height - 30, + column=self.grid_width - 75) + self.issue_button.configure(command=self.issue_button_pressed) + # add background artist reference + self.artist_reference = self.add_text(text=f'*background by {settings.CANVAS_BACKGROUND_ARTIST_NAME}', + row=self.grid_height - 26, column=100, + columnspan=2, font=self.canvas_artist_font, + color=self.artist_name_color) - def make_download_output(self): - text = make_text(self.frame) - text.configure(height=6, state=DISABLED) + def destroy(self): + self.frame.destroy() + + def set_canvas(self, image_path, focus): + im = crop_to_dimension(Image.open(image_path), focus=focus, width_ratio=self.width, height_ratio=self.height) + im = im.resize((self.width, self.height)) + im = ImageTk.PhotoImage(image=im) + background = self.make_fullscreen_canvas() + background.create_image((0, 0), image=im, anchor=tk.NW) + background.image = im # keep a reference prevent gc-ed + self.grid(background, row=0, column=0, rowspan=self.grid_height, columnspan=self.grid_width) + return background + + def make_download_output(self, *args, **kwargs): + text = self.make_text(*args, **kwargs) + text.configure(height=6, width=58) return text - @staticmethod - def grid(component, row=None, column=None, rowspan=None, columnspan=None): + def grid(component, row=None, column=None, rowspan=None, columnspan=None, *args, **kwargs): if row: component.grid_configure(row=int(row)) if column: @@ -107,26 +114,24 @@ def grid(component, row=None, column=None, rowspan=None, columnspan=None): component.grid_configure(rowspan=int(rowspan)) if columnspan: component.grid_configure(columnspan=int(columnspan)) - component.grid() + component.grid(*args, **kwargs) @staticmethod - def pack(component): - component.pack() + def pack(component, *args, **kwargs): + component.pack(*args, **kwargs) def make_fullscreen_canvas(self): - return Canvas(self.frame, borderwidth=0, highlightthickness=0, - height=self.height, width=self.width) + return tk.Canvas(self.frame, borderwidth=0, highlightthickness=0, + height=self.height, width=self.width) - @staticmethod - def redirect_output_to(text_component, text_widget=True, canvas=None): + def redirect_output_to(self, text_component, text_widget=True): import sys if text_widget: from common import StdoutTextWidgetRedirector sys.stdout = StdoutTextWidgetRedirector(text_component) else: from common import StdoutCanvasTextRedirector - sys.stdout = StdoutCanvasTextRedirector(canvas, text_component) - + sys.stdout = StdoutCanvasTextRedirector(self.canvas, text_component) def get_canvas_location(self, row, column, rowspan, columnspan): if row < 0 or row > self.grid_height: @@ -152,15 +157,91 @@ def get_canvas_location(self, row, column, rowspan, columnspan): return width, height - def add_text(self, canvas, text, row=0, column=0, rowspan=1, columnspan=1, font=None, color='black'): + def add_text(self, text, row=0, column=0, rowspan=1, columnspan=1, font=None, color=None): width, height = self.get_canvas_location(row, column, rowspan, columnspan) if not font: - font = self.label_font + font = self.text_font + if not color: + color = self.display_text_color + return self.canvas.create_text((width, height), text=text, font=font, fill=color) - return canvas.create_text((width, height), text=text, font=font, fill=color) - - def add_widget(self, canvas, widget, row=0, column=0, rowspan=1, columnspan=1): + def add_widget(self, widget, row=0, column=0, rowspan=1, columnspan=1): width, height = self.get_canvas_location(row=row, column=column, rowspan=rowspan, columnspan=columnspan) - return canvas.create_window((width, height), window=widget) + return self.canvas.create_window((width, height), window=widget) + + @staticmethod + def issue_button_pressed(): + webbrowser.open(settings.ISSUE_URL) + + def make_button(self, *args, **kwargs): + return tk.Button(master=self.frame, + relief=tk.FLAT, + padx=10, + pady=2, + borderwidth=0, + highlightthickness=0, + activebackground=self.pressed_button_color, + bg=self.button_color, + fg=self.display_text_color, + width=self.button_width, + font=self.button_font, + *args, + **kwargs + ) + + def make_label(self, *args, **kwargs): + return tk.Label(master=self.frame, *args, **kwargs) + + def make_frame(self, *args, **kwargs): + return tk.Frame(master=self.master, *args, **kwargs) + + def make_dropdown(self, default, choices, **kwargs): + dropdown_len = 30 + for index, choice in enumerate(choices): + spaces_left = dropdown_len - len(choice) / 2 + if spaces_left > 0: + choices[index] = (' ' * int(spaces_left / 2)) + choice + (' ' * int(spaces_left / 2)) + + dropdown = PikaxOptionMenu(self.frame, default, *choices) + dropdown.configure( + width=self.dropdown_width, + bg=self.entry_color, + fg=self.input_text_color, + font=self.dropdown_font, + activebackground=self.pressed_button_color, + borderwidth=0, + highlightthickness=0, + **kwargs + ) + return dropdown + + def make_entry(self, *args, **kwargs): + return tk.Entry( + master=self.frame, + borderwidth=0, + highlightthickness=0, + justify=tk.CENTER, + bg=self.entry_color, + fg=self.input_text_color, + insertbackground=self.cursor_color, + font=self.entry_font, + *args, + **kwargs + ) + + def make_text(self, *args, **kwargs): + return tk.Text( + master=self.frame, + wrap=tk.WORD, + height=1, + width=80, + state=tk.NORMAL, + highlightthickness=0, + borderwidth=0, + bg=self.entry_color, + fg=self.input_text_color, + *args, + **kwargs + ) diff --git a/gui/pikaxhandler.py b/gui/pikaxhandler.py index c36a763..a66baca 100644 --- a/gui/pikaxhandler.py +++ b/gui/pikaxhandler.py @@ -10,11 +10,13 @@ class PikaxHandler: def __init__(self): self.pikax = Pikax() self.user = None + self.logged = False def login(self, username, password): status, client = LoginHandler().android_login(username, password) if status is LoginHandler.LoginStatus.ANDROID: self.pikax.android_client = client + self.logged = True else: raise PikaxException('Failed Login') diff --git a/gui/rank.py b/gui/rank.py index 03b5f61..1bbbccb 100644 --- a/gui/rank.py +++ b/gui/rank.py @@ -1,11 +1,7 @@ import re -import sys from datetime import date -from threading import Thread -from tkinter import NORMAL, DISABLED, END -from common import StdoutTextWidgetRedirector, go_to_next_screen, download -from download import DownloadWindow +from common import go_to_next_screen, download from lib.pikax import params from lib.pikax.util import clean_filename from models import PikaxGuiComponent @@ -16,22 +12,17 @@ class RankScreen(PikaxGuiComponent): def __init__(self, master, pikax_handler): super().__init__(master, pikax_handler) - # labels - self.date_label = self.make_label('date') - self.limit_label = self.make_label('limit') - self.type_label = self.make_label('type') - self.content_label = self.make_label('content') - self.download_folder_label = self.make_label('download folder') - - self.labels = [ - self.date_label, - self.limit_label, - self.type_label, - self.content_label, - self.download_folder_label - ] - - # inputs + self.grid_width = 15 + self.grid_height = 10 + + # texts + self.date_text_id = self.add_text(text='date', row=2, column=5) + self.limit_text_id = self.add_text(text='limit', row=3, column=5) + self.type_text_id = self.add_text(text='type', row=4, column=5) + self.content_text_id = self.add_text(text='content', row=5, column=5) + self.download_folder_text_id = self.add_text(text='download folder', row=6, column=5) + + # create inputs self.date_entry = self.make_entry() self.date_entry.insert(0, format(date.today(), '%Y%m%d')) self.limit_entry = self.make_entry() @@ -41,24 +32,35 @@ def __init__(self, master, pikax_handler): self.content_dropdown = self.make_dropdown('illustration', content_types) self.download_folder_entry = self.make_entry() - self.inputs = [ - self.date_entry, - self.limit_entry, - self.type_dropdown, - self.content_dropdown, - self.download_folder_entry - ] - - # buttons - self.back_button = self.make_button('back') - self.download_button = self.make_button('rank and download') - self.back_button.configure(command=self.back_clicked) - self.download_button.configure(command=self.download_clicked) + # add inputs + self.date_entry_id = self.add_widget(widget=self.date_entry, row=2, column=9) + self.limit_entry_id = self.add_widget(widget=self.limit_entry, row=3, column=9) + self.type_dropdown_id = self.add_widget(widget=self.type_dropdown, row=4, column=9) + self.content_dropdown_id = self.add_widget(widget=self.content_dropdown, row=5, column=9) + self.download_folder_entry_id = self.add_widget(widget=self.download_folder_entry, row=6, column=9) + + # create buttons + self.back_button = self.make_button(text='back') + self.download_button = self.make_button(text='download') + + # add buttons + self.back_button_id = self.add_widget(widget=self.back_button, row=7, column=5) + self.download_button_id = self.add_widget(self.download_button, row=7, column=9) + + # output + self.output_id = self.add_text(text='', row=8, column=5, columnspan=4) + self.redirect_output_to(self.output_id, text_widget=False) + # config + self.config_buttons() for widget in self.frame.children.values(): widget.bind('', self.download_clicked) + self.date_entry.focus_set() + self.pack(self.frame, expand=True) - self.load() + def config_buttons(self): + self.back_button.configure(command=self.back_clicked) + self.download_button.configure(command=self.download_clicked) def check_input(self, limit, date, type, content): try: @@ -120,29 +122,5 @@ def back_clicked(self): from menu import MenuScreen go_to_next_screen(self, MenuScreen) - def load(self): - # labels - for index, item in enumerate(self.labels): - item.grid_configure(row=index) - self.grid(item) - # entries - for index, item in enumerate(self.inputs): - item.grid_configure(row=index, column=1) - self.grid(item) - - # buttons - self.back_button.grid_configure(row=len(self.labels)) - self.download_button.grid_configure(row=len(self.labels), column=1) - self.grid(self.back_button) - self.grid(self.download_button) - self.back_button.configure(state=NORMAL) - self.download_button.configure(state=NORMAL) - - self.date_entry.focus_set() - - # frame - self.frame.pack_configure(expand=True) - self.pack(self.frame) - def destroy(self): self.frame.destroy() diff --git a/gui/settings.py b/gui/settings.py index a224332..a80c35b 100644 --- a/gui/settings.py +++ b/gui/settings.py @@ -1,11 +1,73 @@ - -DEFAULT_FONT_FAMILY = 'Helvetica' +DEFAULT_FONT_FAMILY = 'Comic Sans MS' DEFAULT_FONT_SIZE = 14 -MAIN_WINDOW_HEIGHT = 700 -MAIN_WINDOW_WIDTH = 1100 +MAIN_WINDOW_HEIGHT = 600 +MAIN_WINDOW_WIDTH = 1000 +# MAIN_WINDOW_HEIGHT = 450 +# MAIN_WINDOW_WIDTH = 800 DOWNLOAD_WINDOW_SIZE = '565x295' -TITLE = 'PIKAX' +TITLE = 'Pikax' +VERSION = '0.1.2' PIKAX_DOWNLOADER_TITLE = 'Pikax - Pixiv Downloader' -# https://www.pixiv.net/member_illust.php?mode=medium&illust_id=76423007 -LOGIN_BACKGROUND_PATH = 'assets/images/login_background.png' +IMAGES_PATH = 'assets/images/*' +CANVAS_BACKGROUND_PATH = r'background\.[jpg|png]' +CANVAS_BACKGROUND_ARTIST_NAME = 'Aer7o' +ISSUE_URL = 'https://github.com/Redcxx/Pikax/issues' +PIXIV_REGISTER_URL = 'https://accounts.pixiv.net/signup' + +# +# Windows 10 Fonts +# + +# ('System', '@System', 'Terminal', '@Terminal', 'Fixedsys', '@Fixedsys', 'Modern', 'Roman', 'Script', 'Courier', +# 'MS Serif', 'MS Sans Serif', 'Small Fonts', 'Myriad Pro', 'Jaapokki subtract', 'Jaapokki', 'Jaapokki enchance', +# 'Marlett', 'Arial', 'Arabic Transparent', 'Arial Baltic', 'Arial CE', 'Arial CYR', 'Arial Greek', 'Arial TUR', +# 'Arial Black', 'Bahnschrift Light', 'Bahnschrift SemiLight', 'Bahnschrift', 'Bahnschrift SemiBold', +# 'Bahnschrift Light SemiCondensed', 'Bahnschrift SemiLight SemiConde', 'Bahnschrift SemiCondensed', +# 'Bahnschrift SemiBold SemiConden', 'Bahnschrift Light Condensed', 'Bahnschrift SemiLight Condensed', +# 'Bahnschrift Condensed', 'Bahnschrift SemiBold Condensed', 'Calibri', 'Calibri Light', 'Cambria', 'Cambria Math', +# 'Candara', 'Comic Sans MS', 'Consolas', 'Constantia', 'Corbel', 'Courier New', 'Courier New Baltic', +# 'Courier New CE', 'Courier New CYR', 'Courier New Greek', 'Courier New TUR', 'Ebrima', 'Franklin Gothic Medium', +# 'Gabriola', 'Gadugi', 'Georgia', 'Impact', 'Ink Free', 'Javanese Text', 'Leelawadee UI', 'Leelawadee UI Semilight', +# 'Lucida Console', 'Lucida Sans Unicode', 'Malgun Gothic', '@Malgun Gothic', 'Malgun Gothic Semilight', +# '@Malgun Gothic Semilight', 'Microsoft Himalaya', 'Microsoft JhengHei', '@Microsoft JhengHei', +# 'Microsoft JhengHei UI', '@Microsoft JhengHei UI', 'Microsoft JhengHei Light', '@Microsoft JhengHei Light', +# 'Microsoft JhengHei UI Light', '@Microsoft JhengHei UI Light', 'Microsoft New Tai Lue', 'Microsoft PhagsPa', +# 'Microsoft Sans Serif', 'Microsoft Tai Le', '微软雅黑', '@微软雅黑', 'Microsoft YaHei UI', '@Microsoft YaHei UI', +# '微软雅黑 Light', '@微软雅黑 Light', 'Microsoft YaHei UI Light', '@Microsoft YaHei UI Light', 'Microsoft Yi Baiti', +# 'MingLiU-ExtB', '@MingLiU-ExtB', 'PMingLiU-ExtB', '@PMingLiU-ExtB', 'MingLiU_HKSCS-ExtB', '@MingLiU_HKSCS-ExtB', +# 'Mongolian Baiti', 'MS Gothic', '@MS Gothic', 'MS UI Gothic', '@MS UI Gothic', 'MS PGothic', '@MS PGothic', +# 'MV Boli', 'Myanmar Text', 'Nirmala UI', 'Nirmala UI Semilight', 'Palatino Linotype', 'Segoe MDL2 Assets', +# 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Segoe UI Black', 'Segoe UI Emoji', 'Segoe UI Historic', 'Segoe UI Light', +# 'Segoe UI Semibold', 'Segoe UI Semilight', 'Segoe UI Symbol', '宋体', '@宋体', '新宋体', '@新宋体', 'SimSun-ExtB', +# '@SimSun-ExtB', 'Sitka Small', 'Sitka Text', 'Sitka Subheading', 'Sitka Heading', 'Sitka Display', 'Sitka Banner', +# 'Sylfaen', 'Symbol', 'Tahoma', 'Times New Roman', 'Times New Roman Baltic', 'Times New Roman CE', +# 'Times New Roman CYR', 'Times New Roman Greek', 'Times New Roman TUR', 'Trebuchet MS', 'Verdana', 'Webdings', +# 'Wingdings', 'Yu Gothic', '@Yu Gothic', 'Yu Gothic UI', '@Yu Gothic UI', 'Yu Gothic UI Semibold', +# '@Yu Gothic UI Semibold', 'Yu Gothic Light', '@Yu Gothic Light', 'Yu Gothic UI Light', '@Yu Gothic UI Light', +# 'Yu Gothic Medium', '@Yu Gothic Medium', 'Yu Gothic UI Semilight', '@Yu Gothic UI Semilight', 'HoloLens MDL2 Assets', +# 'Agency FB', 'Algerian', 'Book Antiqua', 'Arial Narrow', 'Arial Rounded MT Bold', 'Baskerville Old Face', +# 'Bauhaus 93', 'Bell MT', 'Bernard MT Condensed', 'Bodoni MT', 'Bodoni MT Black', 'Bodoni MT Condensed', +# 'Bodoni MT Poster Compressed', 'Bookman Old Style', 'Bradley Hand ITC', 'Britannic Bold', 'Berlin Sans FB', +# 'Berlin Sans FB Demi', 'Broadway', 'Brush Script MT', 'Bookshelf Symbol 7', 'Californian FB', 'Calisto MT', +# 'Castellar', 'Century Schoolbook', 'Centaur', 'Century', 'Chiller', 'Colonna MT', 'Cooper Black', +# 'Copperplate Gothic Bold', 'Copperplate Gothic Light', 'Curlz MT', 'Elephant', 'Engravers MT', 'Eras Bold ITC', +# 'Eras Demi ITC', 'Eras Light ITC', 'Eras Medium ITC', 'Felix Titling', 'Forte', 'Franklin Gothic Book', +# 'Franklin Gothic Demi', 'Franklin Gothic Demi Cond', 'Franklin Gothic Heavy', 'Franklin Gothic Medium Cond', +# 'Freestyle Script', 'French Script MT', 'Footlight MT Light', 'Garamond', 'Gigi', 'Gill Sans MT', +# 'Gill Sans MT Condensed', 'Gill Sans Ultra Bold Condensed', 'Gill Sans Ultra Bold', 'Gloucester MT Extra Condensed', +# 'Gill Sans MT Ext Condensed Bold', 'Century Gothic', 'Goudy Old Style', 'Goudy Stout', 'Harlow Solid Italic', +# 'Harrington', 'Haettenschweiler', 'High Tower Text', 'Imprint MT Shadow', 'Informal Roman', 'Blackadder ITC', +# 'Edwardian Script ITC', 'Kristen ITC', 'Jokerman', 'Juice ITC', 'Kunstler Script', 'Wide Latin', 'Lucida Bright', +# 'Lucida Calligraphy', 'Lucida Fax', 'Lucida Handwriting', 'Lucida Sans', 'Lucida Sans Typewriter', 'Magneto', +# 'Maiandra GD', 'Matura MT Script Capitals', 'Mistral', 'Modern No. 20', 'Monotype Corsiva', 'Niagara Engraved', +# 'Niagara Solid', 'OCR A Extended', 'Old English Text MT', 'Onyx', 'MS Outlook', 'Palace Script MT', 'Papyrus', +# 'Parchment', 'Perpetua', 'Perpetua Titling MT', 'Playbill', 'Poor Richard', 'Pristina', 'Rage Italic', 'Ravie', +# 'MS Reference Sans Serif', 'MS Reference Specialty', 'Rockwell Condensed', 'Rockwell', 'Rockwell Extra Bold', +# 'Script MT Bold', 'Showcard Gothic', 'Snap ITC', 'Stencil', 'Tw Cen MT', 'Tw Cen MT Condensed', +# 'Tw Cen MT Condensed Extra Bold', 'Tempus Sans ITC', 'Viner Hand ITC', 'Vivaldi', 'Vladimir Script', 'Wingdings 2', +# 'Wingdings 3', '方正舒体', '@方正舒体', '方正姚体', '@方正姚体', '隶书', '@隶书', '幼圆', '@幼圆', '华文彩云', '@华文彩云', +# '华文仿宋', '@华文仿宋', '华文琥珀', '@华文琥珀', '华文楷体', '@华文楷体', '华文隶书', '@华文隶书', '华文宋体', '@华文宋体', +# '华文细黑', '@华文细黑', '华文行楷', '@华文行楷', '华文新魏', '@华文新魏', '华文中宋', '@华文中宋', 'MT Extra', '等线', '@等线', +# '等线 Light', '@等线 Light', '仿宋', '@仿宋', '楷体', '@楷体', '黑体', '@黑体', 'Open Sans', 'Open Sans Extrabold', +# 'Open Sans Light', 'Open Sans Semibold', 'Amiko', 'Amiko SemiBold')