-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
12 changed files
with
662 additions
and
0 deletions.
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 |
---|---|---|
|
@@ -102,3 +102,7 @@ venv.bak/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# Personalized | ||
.idea/* | ||
*.json |
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,29 @@ | ||
# | ||
# ChiTrain | ||
# Copyright (C) 2018 Dorian Turba | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
from tkinter import Menu | ||
|
||
from EditLengthMenu import EditLengthMenu | ||
|
||
|
||
class EditGameSettingMenu(Menu): | ||
edit_length_menu: EditLengthMenu | ||
|
||
def __init__(self): | ||
Menu.__init__(self) | ||
self.edit_length_menu = EditLengthMenu() | ||
self.add_cascade(label='Game Length', menu=self.edit_length_menu) |
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,35 @@ | ||
# | ||
# ChiTrain | ||
# Copyright (C) 2018 Dorian Turba | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
from tkinter import Menu, IntVar | ||
|
||
|
||
class EditLengthMenu(Menu): | ||
game_length: IntVar | ||
|
||
def __init__(self): | ||
Menu.__init__(self) | ||
self.game_length = IntVar(None, 10) | ||
self.add_radiobutton(label="10 words (default)", | ||
value=10, | ||
variable=self.game_length) | ||
self.add_radiobutton(label="25 words", | ||
value=25, | ||
variable=self.game_length) | ||
self.add_radiobutton(label="50 words", | ||
value=50, | ||
variable=self.game_length) |
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,58 @@ | ||
# | ||
# ChiTrain | ||
# Copyright (C) 2018 Dorian Turba | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
from functools import partial | ||
from tkinter import Menu, Tk | ||
|
||
import Window | ||
import WordsSets | ||
from EditGameSettingMenu import EditGameSettingMenu | ||
|
||
|
||
class EditMenu(Menu): | ||
main_menu: Menu | ||
window: Window | ||
show_set_menu: Menu | ||
edit_set_menu: Menu | ||
edit_game_settings_menu: EditGameSettingMenu | ||
|
||
def __init__(self, main_menu) -> None: | ||
Menu.__init__(self) | ||
self.main_menu = main_menu | ||
self.window = main_menu.parent | ||
self.edit_set_menu = Menu(self) | ||
self.edit_game_settings_menu = EditGameSettingMenu() | ||
self.add_cascade(label='Edit Sets', menu=self.edit_set_menu) | ||
self.add_cascade(label='Edit Game Settings', | ||
menu=self.edit_game_settings_menu) | ||
self.update_menu() | ||
|
||
def update_menu(self) -> None: | ||
if self.window.words_sets == 0: | ||
self.entryconfig('Edit Sets', state='disabled') | ||
else: | ||
self.entryconfig('Edit Sets', state='normal') | ||
for words_set in self.window.words_sets.w_s_array: | ||
p_edit = partial(self.create_set_window, words_set) | ||
self.edit_set_menu.add_cascade(label=words_set.get_name(), | ||
command=p_edit) | ||
return | ||
|
||
def create_set_window(self, word_set: WordsSets): | ||
window = Tk() | ||
Window.SetWindow(self, word_set, window) | ||
return |
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,50 @@ | ||
# | ||
# ChiTrain | ||
# Copyright (C) 2018 Dorian Turba | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
from tkinter import Menu | ||
|
||
|
||
def callback(): | ||
print('called the callback!') | ||
pass | ||
|
||
|
||
def import_pack(): | ||
print('called the import!') | ||
pass | ||
|
||
|
||
def export_pack(): | ||
print('called the export!') | ||
pass | ||
|
||
|
||
class FileMenu(Menu): | ||
def __init__(self, window) -> None: | ||
Menu.__init__(self) | ||
self.add_command(label='Start Game', command=window.start) | ||
self.add_command(label='Restart Game', command=callback) | ||
self.add_command(label='Stop Game', command=callback) | ||
self.add_separator() | ||
self.add_command(label='New Set', command=callback) | ||
self.add_command(label='Import Set Pack', command=import_pack) | ||
self.add_command(label='Export Set Pack', command=export_pack) | ||
self.add_separator() | ||
self.add_command(label='Settings', command=callback) | ||
self.add_separator() | ||
self.add_command(label='Exit', command=window.ask_quit) | ||
return |
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,43 @@ | ||
# | ||
# ChiTrain | ||
# Copyright (C) 2018 Dorian Turba | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
import webbrowser | ||
from tkinter import Menu | ||
|
||
|
||
def callback(): | ||
print('called the callback!') | ||
pass | ||
|
||
|
||
def repository_redirect(): | ||
webbrowser.open('https://github.com/Vikka/ChiTrain') | ||
|
||
|
||
def issue_redirect(): | ||
webbrowser.open('https://github.com/Vikka/ChiTrain/issues') | ||
|
||
|
||
class HelpMenu(Menu): | ||
def __init__(self) -> None: | ||
Menu.__init__(self) | ||
self.add_command(label='Getting Started', command=callback) | ||
self.add_separator() | ||
self.add_command(label='Github Repository', | ||
command=repository_redirect) | ||
self.add_command(label='Report Problem', command=issue_redirect) | ||
self.add_command(label='About', command=callback) |
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,41 @@ | ||
# | ||
# ChiTrain | ||
# Copyright (C) 2018 Dorian Turba | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
from tkinter import Menu | ||
|
||
import EditMenu | ||
import FileMenu | ||
import HelpMenu | ||
import Window | ||
|
||
|
||
class MainMenuBar(Menu): | ||
parent: Window | ||
file_menu: FileMenu | ||
edit_menu: EditMenu | ||
help_menu: HelpMenu | ||
|
||
def __init__(self, parent: Window) -> None: | ||
Menu.__init__(self) | ||
self.parent = parent | ||
self.file_menu = FileMenu.FileMenu(self.parent) | ||
self.edit_menu = EditMenu.EditMenu(self) | ||
self.help_menu = HelpMenu.HelpMenu() | ||
self.add_cascade(label='File', menu=self.file_menu) | ||
self.add_cascade(label='Edit', menu=self.edit_menu) | ||
self.add_cascade(label='Help', menu=self.help_menu) | ||
return |
Oops, something went wrong.