This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84adfe9
commit dd63860
Showing
10 changed files
with
157 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"conventionalCommits.scopes": [ | ||
"requester", | ||
"download" | ||
"download", | ||
"ui" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from .main import Main | ||
|
||
__all__ = [ | ||
'Main', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from .title import Title | ||
from .search import Search | ||
from .show import Show | ||
from .filters import Filters | ||
from .buttons import Buttons | ||
|
||
__all__ = [ | ||
'Title', | ||
'Search', | ||
'Show', | ||
'Filters', | ||
'Buttons', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from tkinter import Frame, Button | ||
|
||
from utils.download import Download | ||
|
||
|
||
class Buttons(Frame): | ||
def __init__(self, master): | ||
super().__init__(master, height=50) | ||
|
||
self.import_button = Button( | ||
self, | ||
text='导入', | ||
background='white', | ||
command=Download().main | ||
) | ||
self.download_button = Button( | ||
self, | ||
text='下载', | ||
background='white' | ||
) | ||
self.exit_button = Button( | ||
self, | ||
text='退出', | ||
background='white', | ||
command=master.quit | ||
) | ||
|
||
self.exit_button.pack(side='right') | ||
self.download_button.pack(side='right', padx=10) | ||
self.import_button.pack(side='right') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from tkinter import Frame, Label | ||
from tkinter.ttk import Combobox | ||
|
||
|
||
class Filters(Frame): | ||
def __init__(self, master): | ||
super().__init__(master, height=50) | ||
|
||
self.sort_label = Label(self, text='排序方式:') | ||
self.sort_combobox = Combobox(self) | ||
self.game_version_label = Label(self, text='游戏版本:') | ||
self.game_version_combobox = Combobox(self) | ||
self.modpack_version_label = Label(self, text='整合包版本:') | ||
self.modpack_version_combobox = Combobox(self) | ||
|
||
self.sort_label.pack(side='left') | ||
self.sort_combobox.pack(side='left') | ||
self.game_version_label.pack(side='left', padx=(10, 0)) | ||
self.game_version_combobox.pack(side='left') | ||
self.modpack_version_label.pack(side='left', padx=(10, 0)) | ||
self.modpack_version_combobox.pack(side='left') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from tkinter import Frame, Entry, Label, Button | ||
|
||
|
||
class Search(Frame): | ||
def __init__(self, master): | ||
super().__init__(master, height=50) | ||
|
||
self.search_entry = Entry(self) | ||
self.space1_label = Label(self, width=1) | ||
self.search_button = Button(self, text='搜索', background='white') | ||
|
||
self.search_entry.pack(side='left', fill='both', expand=True) | ||
self.space1_label.pack(side='left', fill='both') | ||
self.search_button.pack(side='left', fill='y') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from tkinter import Frame, Listbox | ||
|
||
|
||
class Show(Frame): | ||
def __init__(self, master): | ||
super().__init__(master) | ||
|
||
self.list_listbox = Listbox(self, font=('Arial', 12)) | ||
|
||
self.list_listbox.pack(fill='both', expand=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from tkinter import Frame, Label | ||
|
||
from utils.constant import NAME_WITH_SPACE | ||
|
||
|
||
class Title(Frame): | ||
def __init__(self, master): | ||
super().__init__(master, height=50) | ||
|
||
Label(self, text=NAME_WITH_SPACE, font=('Arial', 12)).pack(side='left') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from tkinter import Tk | ||
from ctypes import windll | ||
|
||
from utils.constant import NAME_WITH_SPACE, WINDOW, PATH | ||
from utils.window import frames | ||
|
||
|
||
class Main(Tk): | ||
PACK_KWARGS = { | ||
'fill': 'both', | ||
'padx': 15, | ||
'pady': 15 | ||
} | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self.geometry(WINDOW.SIZE) | ||
self.minsize(WINDOW.WIDTH, WINDOW.HEIGHT) | ||
self.title(NAME_WITH_SPACE) | ||
self.iconbitmap(PATH.ICON_PATH) | ||
|
||
# High DPI | ||
# https://stackoverflow.com/questions/62794931/high-dpi-tkinter-re-scaling-when-i-run-it-in-spyder-and-when-i-run-it-direct-in | ||
windll.shcore.SetProcessDpiAwareness(2) | ||
scale_factor = windll.shcore.GetScaleFactorForDevice(0) / 75 | ||
self.tk.call('tk', 'scaling', scale_factor) | ||
|
||
self.title_frame = frames.Title(self) | ||
self.search_frame = frames.Search(self) | ||
self.show_frame = frames.Show(self) | ||
self.filters_frame = frames.Filters(self) | ||
self.buttons_frame = frames.Buttons(self) | ||
|
||
self.title_frame.pack(**self.PACK_KWARGS) | ||
self.search_frame.pack(**self.PACK_KWARGS) | ||
self.show_frame.pack(**self.PACK_KWARGS, expand=True) | ||
self.filters_frame.pack(**self.PACK_KWARGS) | ||
self.buttons_frame.pack(**self.PACK_KWARGS) | ||
|
||
self.mainloop() | ||
|
||
|
||
if __name__ == '__main__': | ||
Main() |