StoryMaker-karjakak 1.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. storymaker_karjakak-1.0.3/PKG-INFO +41 -0
  2. storymaker_karjakak-1.0.3/README.md +27 -0
  3. storymaker_karjakak-1.0.3/StoryMaker_karjakak.egg-info/PKG-INFO +41 -0
  4. storymaker_karjakak-1.0.3/StoryMaker_karjakak.egg-info/SOURCES.txt +21 -0
  5. storymaker_karjakak-1.0.3/StoryMaker_karjakak.egg-info/dependency_links.txt +1 -0
  6. storymaker_karjakak-1.0.3/StoryMaker_karjakak.egg-info/entry_points.txt +2 -0
  7. storymaker_karjakak-1.0.3/StoryMaker_karjakak.egg-info/top_level.txt +4 -0
  8. storymaker_karjakak-1.0.3/pyproject.toml +29 -0
  9. storymaker_karjakak-1.0.3/setup.cfg +4 -0
  10. storymaker_karjakak-1.0.3/story_maker/__init__.py +2 -0
  11. storymaker_karjakak-1.0.3/story_maker/blessing_pro.py +311 -0
  12. storymaker_karjakak-1.0.3/story_maker/main_frame.py +191 -0
  13. storymaker_karjakak-1.0.3/story_maker/story_archive/__init__.py +4 -0
  14. storymaker_karjakak-1.0.3/story_maker/story_archive/choices.py +14 -0
  15. storymaker_karjakak-1.0.3/story_maker/story_archive/story_archive.py +123 -0
  16. storymaker_karjakak-1.0.3/story_maker/story_archive/story_data.py +10 -0
  17. storymaker_karjakak-1.0.3/story_maker/story_archive/story_load.py +61 -0
  18. storymaker_karjakak-1.0.3/story_maker/story_structure/__init__.py +7 -0
  19. storymaker_karjakak-1.0.3/story_maker/story_structure/story_beginning.py +34 -0
  20. storymaker_karjakak-1.0.3/story_maker/story_structure/story_multiple_choices.py +58 -0
  21. storymaker_karjakak-1.0.3/story_maker/story_structure/story_multiple_stories.py +77 -0
  22. storymaker_karjakak-1.0.3/story_maker/story_structure/story_save_delete_button.py +27 -0
  23. storymaker_karjakak-1.0.3/story_maker/story_structure/story_selection.py +99 -0
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: StoryMaker-karjakak
3
+ Version: 1.0.3
4
+ Summary: Story Maker for devotion and blessing for others.
5
+ Author-email: karjakak <kakkarja.github@gmail.com>
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/kakkarja/Story_Maker
8
+ Classifier: Environment :: Win32 (MS Windows)
9
+ Classifier: Environment :: MacOS X
10
+ Classifier: Intended Audience :: End Users/Desktop
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+
15
+ # Create your devotion story and share to others as blessing ❤️
16
+
17
+ **Story Maker**
18
+
19
+ * Need to create a folder first by pressing the **save** button.
20
+ * Than click the folder.
21
+ * Inside the empty folder than start to make a story and **save**.
22
+ * The **'<'** button is going back to folders area.
23
+ * The **'>'** button is going back to files area.
24
+ * The **delete** button:
25
+ * Delete a file.
26
+ * Folder empty, wil delete the folder.
27
+ * Pressing ```Ctrl + D``` buttons will delete all contents of all fields.
28
+ > **WARNING!**
29
+ _Be careful not to delete everything before save it._
30
+ * You can edit existing story by click it, and it will loads to the story fields.
31
+
32
+ **NOTE:**
33
+ In the folders area, if press **save** button, will create another folder.
34
+
35
+ ![starter](pictures/starter.png)
36
+
37
+ ![devotion](pictures/devotion.png)
38
+
39
+ ![devotion_complete](pictures/devotion_complete.png)
40
+
41
+ ![story_maker](pictures/story_maker.png)
@@ -0,0 +1,27 @@
1
+ # Create your devotion story and share to others as blessing ❤️
2
+
3
+ **Story Maker**
4
+
5
+ * Need to create a folder first by pressing the **save** button.
6
+ * Than click the folder.
7
+ * Inside the empty folder than start to make a story and **save**.
8
+ * The **'<'** button is going back to folders area.
9
+ * The **'>'** button is going back to files area.
10
+ * The **delete** button:
11
+ * Delete a file.
12
+ * Folder empty, wil delete the folder.
13
+ * Pressing ```Ctrl + D``` buttons will delete all contents of all fields.
14
+ > **WARNING!**
15
+ _Be careful not to delete everything before save it._
16
+ * You can edit existing story by click it, and it will loads to the story fields.
17
+
18
+ **NOTE:**
19
+ In the folders area, if press **save** button, will create another folder.
20
+
21
+ ![starter](pictures/starter.png)
22
+
23
+ ![devotion](pictures/devotion.png)
24
+
25
+ ![devotion_complete](pictures/devotion_complete.png)
26
+
27
+ ![story_maker](pictures/story_maker.png)
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: StoryMaker-karjakak
3
+ Version: 1.0.3
4
+ Summary: Story Maker for devotion and blessing for others.
5
+ Author-email: karjakak <kakkarja.github@gmail.com>
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/kakkarja/Story_Maker
8
+ Classifier: Environment :: Win32 (MS Windows)
9
+ Classifier: Environment :: MacOS X
10
+ Classifier: Intended Audience :: End Users/Desktop
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+
15
+ # Create your devotion story and share to others as blessing ❤️
16
+
17
+ **Story Maker**
18
+
19
+ * Need to create a folder first by pressing the **save** button.
20
+ * Than click the folder.
21
+ * Inside the empty folder than start to make a story and **save**.
22
+ * The **'<'** button is going back to folders area.
23
+ * The **'>'** button is going back to files area.
24
+ * The **delete** button:
25
+ * Delete a file.
26
+ * Folder empty, wil delete the folder.
27
+ * Pressing ```Ctrl + D``` buttons will delete all contents of all fields.
28
+ > **WARNING!**
29
+ _Be careful not to delete everything before save it._
30
+ * You can edit existing story by click it, and it will loads to the story fields.
31
+
32
+ **NOTE:**
33
+ In the folders area, if press **save** button, will create another folder.
34
+
35
+ ![starter](pictures/starter.png)
36
+
37
+ ![devotion](pictures/devotion.png)
38
+
39
+ ![devotion_complete](pictures/devotion_complete.png)
40
+
41
+ ![story_maker](pictures/story_maker.png)
@@ -0,0 +1,21 @@
1
+ README.md
2
+ pyproject.toml
3
+ StoryMaker_karjakak.egg-info/PKG-INFO
4
+ StoryMaker_karjakak.egg-info/SOURCES.txt
5
+ StoryMaker_karjakak.egg-info/dependency_links.txt
6
+ StoryMaker_karjakak.egg-info/entry_points.txt
7
+ StoryMaker_karjakak.egg-info/top_level.txt
8
+ story_maker/__init__.py
9
+ story_maker/blessing_pro.py
10
+ story_maker/main_frame.py
11
+ story_maker/story_archive/__init__.py
12
+ story_maker/story_archive/choices.py
13
+ story_maker/story_archive/story_archive.py
14
+ story_maker/story_archive/story_data.py
15
+ story_maker/story_archive/story_load.py
16
+ story_maker/story_structure/__init__.py
17
+ story_maker/story_structure/story_beginning.py
18
+ story_maker/story_structure/story_multiple_choices.py
19
+ story_maker/story_structure/story_multiple_stories.py
20
+ story_maker/story_structure/story_save_delete_button.py
21
+ story_maker/story_structure/story_selection.py
@@ -0,0 +1,2 @@
1
+ [gui_scripts]
2
+ SMD = story_maker:main
@@ -0,0 +1,4 @@
1
+ Archive_Story_Maker
2
+ dist
3
+ pictures
4
+ story_maker
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "StoryMaker-karjakak"
7
+ version = "1.0.3"
8
+
9
+ requires-python = ">=3.10"
10
+ authors = [{name = "karjakak", email = "kakkarja.github@gmail.com"}]
11
+ description = "Story Maker for devotion and blessing for others."
12
+ readme = "README.md"
13
+ license = "BSD-3-Clause"
14
+
15
+ classifiers = [
16
+ "Environment :: Win32 (MS Windows)",
17
+ "Environment :: MacOS X",
18
+ "Intended Audience :: End Users/Desktop",
19
+ "Programming Language :: Python :: 3.10",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/kakkarja/Story_Maker"
24
+
25
+ [project.gui-scripts]
26
+ SMD = "story_maker:main"
27
+
28
+ [tool.setuptools.packages.find]
29
+ where = ["."]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,2 @@
1
+ from .main_frame import story_maker
2
+ from .blessing_pro import main
@@ -0,0 +1,311 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created on Thu Apr 5 11:23:58 2018
4
+
5
+ @author: karja
6
+ """
7
+
8
+ from tkinter import (
9
+ Menu, StringVar, Frame, Scrollbar,
10
+ Text, Radiobutton, TOP, BOTTOM, BOTH,
11
+ RIGHT, LEFT, END, Tk, ttk,
12
+ filedialog as fil,
13
+ messagebox as mes
14
+ )
15
+ import webbrowser
16
+ from pathlib import Path
17
+ from contextlib import chdir
18
+ try:
19
+ from .story_archive import StoryFilesLoads, Choices
20
+ from .story_structure import StorySelection
21
+ except:
22
+ from story_archive import StoryFilesLoads, Choices
23
+ from story_structure import StorySelection
24
+
25
+
26
+ # Class that generate Windows console and stories from Blessing_Story folder
27
+ class Bless:
28
+
29
+ def __init__(self,root):
30
+ super().__init__()
31
+ self.asw = None
32
+ self.cycle = 0
33
+ self.root = root
34
+ root.title("Blessing Devotion Interactive Story ✟ Story Reader and Maker")
35
+ root.geometry("623x720+257+33")
36
+ root.resizable(False, False)
37
+
38
+ # Binding short-cut for keyboard
39
+ self.root.bind('<Control-d>', self.dele)
40
+ self.root.bind('<Control-c>', self.copy)
41
+ self.root.bind('<Control-s>', self.save_as)
42
+ self.root.bind('<Control-x>', self.ex)
43
+ self.root.bind('<Control-D>', self.dele)
44
+ self.root.bind('<Control-C>', self.copy)
45
+ self.root.bind('<Control-S>', self.save_as)
46
+ self.root.bind('<Control-X>', self.ex)
47
+ self.root.bind('<Control-f>', self.refresh)
48
+ self.root.bind('<Control-F>', self.refresh)
49
+ self.root.bind('<Control-P>', self.paste)
50
+ self.root.bind('<Control-p>', self.paste)
51
+
52
+ # Menu setting
53
+ self.menu_bar = Menu(root) # menu begins
54
+ self.file_menu = Menu(self.menu_bar, tearoff=0)
55
+ self.menu_bar.add_cascade(label='File', menu=self.file_menu)
56
+ self.edit_menu = Menu(self.menu_bar, tearoff=0)
57
+ self.menu_bar.add_cascade(label='Edit', menu=self.edit_menu)
58
+ self.root.config(menu=self.menu_bar) # menu ends
59
+
60
+ # Help click to website
61
+ self.about_menu = Menu(self.menu_bar, tearoff = 0)
62
+ self.menu_bar.add_cascade(label = 'About', menu = self.about_menu)
63
+ self.about_menu.add_command(label = 'Help',compound='left',
64
+ command=self.about)
65
+
66
+ # File menu
67
+ self.file_menu.add_command(label='Save as', compound='left',
68
+ accelerator='Ctrl+S', command=self.save_as)
69
+ self.file_menu.add_command(label='Refresh File', compound='left',
70
+ accelerator='Ctrl+F', command=self.refresh)
71
+ self.file_menu.add_separator()
72
+ self.file_menu.add_command(label='Exit', compound='left',
73
+ accelerator='Ctrl+X', command=self.ex)
74
+
75
+ # Edit menu
76
+ self.edit_menu.add_command(label='Copy', accelerator='Ctrl+C',
77
+ compound='left', command=self.copy)
78
+ self.edit_menu.add_command(label='Paste', accelerator='Ctrl+P',
79
+ compound='left', command=self.paste)
80
+ self.edit_menu.add_command(label='Delete', accelerator='Ctrl+D',
81
+ compound='left', command=self.dele)
82
+
83
+
84
+ # Variables to connect within widget.
85
+ self.st1 = StringVar()
86
+
87
+ # Checking the existence of the directory
88
+ self.h_path = Path.home().joinpath("StoryMaker")
89
+
90
+ # Create frame, combobox, textbox, scrollbar, and radiobuttons
91
+ self.combo = StorySelection(self.root, self.h_path)
92
+ self.combo.combo_stories.bind("<<ComboboxSelected>>", self.choice, add=True)
93
+ self.frame = Frame(self.root)
94
+ self.frame.pack(side = BOTTOM, fill = BOTH, expand = True)
95
+ self.scr = Scrollbar(self.frame)
96
+ self.scr.pack(side = RIGHT, fill = BOTH, pady = 2, padx = 1)
97
+ self.stbox = Text(self.frame, relief = 'sunken', wrap="word")
98
+ self.stbox.pack(side = LEFT, fill = BOTH, expand = True,
99
+ padx = 2, pady = 2)
100
+ self.scr.config(command=self.stbox.yview)
101
+ self.stbox.config(
102
+ yscrollcommand=self.scr.set, font=("Avenir", "12", "bold")
103
+ )
104
+ # self.bttr = Button(self.root, text = 'Dictionary', command = self.trans,
105
+ # relief = 'groove')
106
+ # self.bttr.pack(side='left', padx = 3, pady = 2)
107
+ self.rb1 = Radiobutton(self.root, text = 'A', variable=self.st1,
108
+ value = 'A', compound='left',
109
+ command = self.choice, tristatevalue = 0)
110
+ self.rb1.pack(side='left', expand = True)
111
+ self.rb2 = Radiobutton(self.root, text = 'B', variable=self.st1,
112
+ value = 'B', compound=LEFT,
113
+ command = self.choice, tristatevalue = 0)
114
+ self.rb2.pack(side='left', expand = True)
115
+ self.rb3 = Radiobutton(self.root, text = 'C', variable=self.st1,
116
+ value = 'C', compound=LEFT,
117
+ command = self.choice, tristatevalue = 0)
118
+ self.rb3.pack(side='left', expand = True)
119
+ self._set_combo(False)
120
+
121
+ def _text_conf(self, editable=False):
122
+ if not editable:
123
+ self.stbox.config(state="disabled")
124
+ else:
125
+ self.stbox.config(state="normal")
126
+
127
+ def _running(self):
128
+ if self.story_run == self.combo.combo_stories.get() and self.asw:
129
+ return True
130
+ self.refresh()
131
+
132
+ # Choices function for choosing A/B/C
133
+ def choice(self, event = None):
134
+ self._text_conf(True)
135
+ self.asw = (
136
+ Choices(self.st1.get()) if self.st1.get() in ["A", "B", "C"] else ""
137
+ )
138
+ match self.cycle:
139
+ case 0:
140
+ self.story_run = self.combo.combo_stories.get()
141
+ self.clear()
142
+ self.story()
143
+ if self.docr:
144
+ self.s_story1()
145
+ self.cycle += 1
146
+ case 1:
147
+ if self._running():
148
+ self.get_ans(self.asw, self.cycle)
149
+ self.s_story2()
150
+ self.cycle += 1
151
+ case 2:
152
+ if self._running():
153
+ self.get_ans(self.asw, self.cycle)
154
+ self.s_story3()
155
+ self.cycle += 1
156
+ if self.cycle == 3:
157
+ self._set_combo(False)
158
+ self.cycle = 0
159
+ self._text_conf()
160
+
161
+ def _insert_answer(self, part: int, ans: str, sentences: str):
162
+ double = "\n\n" if part == 2 else "\n"
163
+ self.stbox.insert(END, f"{double}Choose: {ans}\n")
164
+ self.stbox.insert(END, f"\n{sentences}")
165
+ del double, part, ans, sentences
166
+
167
+ # Answering function
168
+ def get_ans(self, ans=None, part=None):
169
+
170
+ match part:
171
+ case 1:
172
+ self._insert_answer(part, ans, self.docr[0]["stories"]["first"][ans])
173
+ case 2:
174
+ self._insert_answer(part, ans, self.docr[0]["stories"]["second"][ans])
175
+
176
+ # Filling stories parts into 9 set of class properties
177
+ def story(self):
178
+
179
+ if story := self.combo.combo_stories.get():
180
+ with chdir(self.combo.path):
181
+ self.docr.extend(StoryFilesLoads(self.combo.path).data_extract(story))
182
+
183
+ # Starting first part of a story
184
+ def s_story1(self):
185
+ self.stbox.insert("1.0", f"{self.docr[0]["stories"]["begin"]}\n\n")
186
+ for i in [
187
+ f"{k}. {v}" for k, v in self.docr[1]["choices"]["first"].items()
188
+ ]:
189
+ self.stbox.insert(END, i+'\n')
190
+
191
+ # 2nd part of a story
192
+ def s_story2(self):
193
+ self.stbox.insert(END, '\n')
194
+ for i in [
195
+ f"{k}. {v}" for k, v in self.docr[1]["choices"]["second"].items()
196
+ ]:
197
+ self.stbox.insert(END, '\n' + i )
198
+ self.st1.set(1)
199
+
200
+ # 3rd of a story
201
+ def s_story3(self):
202
+ stc = self.docr[2]["scriptures"].get(self.asw)
203
+ if stc:
204
+ self.stbox.insert(END, f"\n\n{stc.upper()}")
205
+ del stc
206
+
207
+ def _set_combo(self, normal: bool = True):
208
+ state = "normal" if normal else "disabled"
209
+ self.rb1.config(state=state)
210
+ self.rb2.config(state=state)
211
+ self.rb3.config(state=state)
212
+
213
+ # Clear function for starting new story afresh
214
+ def clear(self):
215
+ self._inner_del()
216
+ self.docr = []
217
+ self._set_combo(bool(self.combo.combo_stories.get()))
218
+ self.st1.set(1)
219
+
220
+ # Link to lWW Github page
221
+ def about(self):
222
+ webbrowser.open_new(r"https://github.com/kakkarja/Story_Maker")
223
+
224
+ # Select all text content
225
+ def select_all(self):
226
+ self.stbox.tag_add('sel', '1.0', 'end')
227
+
228
+ # Generate Copy Function
229
+ def copy(self, event = None):
230
+ self.root.clipboard_clear()
231
+ self.select_all()
232
+ self.stbox.event_generate("<<Copy>>")
233
+
234
+ def paste(self, event = None):
235
+ self._text_conf(True)
236
+ self.stbox.event_generate("<<Paste>>")
237
+ self._text_conf()
238
+
239
+ def _inner_del(self):
240
+ self.select_all()
241
+ self.stbox.event_generate("<<Clear>>")
242
+
243
+ # Generate Delete Function
244
+ def dele(self, event = None):
245
+ self._text_conf(True)
246
+ self._inner_del()
247
+ self._text_conf()
248
+ self._set_combo(False)
249
+
250
+ # Generate Exit Function
251
+ def ex(self, event = None):
252
+ self.root.destroy()
253
+
254
+ # Writing to a .txt file (misc)
255
+ def write_to_file(self, file_name):
256
+ sen = self.combo.combo_stories.get()
257
+ if selection := self.stbox.get('1.0', 'end'):
258
+ content = (
259
+ f"{sen}\n\n{selection}" if sen else selection
260
+ )
261
+ with open(file_name, 'w') as the_file:
262
+ the_file.write(content)
263
+ del sen, selection
264
+
265
+ # Generate Save as function dialog
266
+ def save_as(self, event = None):
267
+ input_file_name = fil.asksaveasfilename(
268
+ defaultextension=".txt",
269
+ filetypes=[("Text Documents", "*.txt")] #("All Files", "*.*")
270
+ )
271
+ if input_file_name:
272
+ self.write_to_file(input_file_name)
273
+
274
+ # Refresh list of files in BP
275
+ def refresh(self, event = None):
276
+ self.cycle = 0
277
+ self.choice()
278
+
279
+ # Dictionary Function
280
+ def trans(self, event = None):
281
+ pass
282
+
283
+ def main():
284
+ pth = Path.home().joinpath("StoryMaker")
285
+ begin = Tk()
286
+ begin.withdraw()
287
+ ans = mes.askyesnocancel("Blessing Project", "Load story or Create story? (yes to load)")
288
+ files = bool(list(pth.iterdir())) if pth.exists() else False
289
+ if pth.exists() and files and ans:
290
+ my_gui = Bless(begin)
291
+ begin.deiconify()
292
+ begin.mainloop()
293
+ main()
294
+ elif ans == False or all([ans == True, not files]) :
295
+ try:
296
+ from .main_frame import story_maker
297
+ except:
298
+ from main_frame import story_maker
299
+ if ans:
300
+ print("No stories yet, please make one!")
301
+ mes.showinfo("No Stories", "No stories exist yet, please make one!")
302
+ begin.destroy()
303
+ story_maker()
304
+ main()
305
+ else:
306
+ begin.destroy()
307
+
308
+
309
+ if __name__ == '__main__':
310
+ main()
311
+
@@ -0,0 +1,191 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © kakkarja (K A K)
3
+
4
+ from tkinter import Tk, simpledialog, messagebox
5
+ from .story_structure import BeginningStory, MultipleChoices, MultipleStories, SaveDeleteButton, StorySelection
6
+ from .story_archive import StoryFilesArchive, StoryFilesLoads
7
+ from pathlib import Path
8
+ from contextlib import chdir
9
+
10
+
11
+ class MainFrame(Tk):
12
+ """The Story Maker"""
13
+
14
+ def __init__(self):
15
+ super().__init__()
16
+ self.stories = {"stories": {
17
+ "begin": None,
18
+ "first": "",
19
+ "second": "",
20
+ }}
21
+ self.choices = {"choices":{
22
+ "first": "",
23
+ "second": "",
24
+ }}
25
+ self.title("Story Maker")
26
+ self.scriptures = {"scriptures": ""}
27
+ self.path = Path("~").expanduser().joinpath("StoryMaker")
28
+ self.checking_dir()
29
+ self.combo_stories = StorySelection(self, self.path)
30
+ self.combo_stories.combo_stories.bind("<<ComboboxSelected>>", self.load_formats, add=True)
31
+ self.beginning = BeginningStory(self)
32
+ self.multiple_choices_first = MultipleChoices(self, "First Multiple Choices")
33
+ self.multiple_stories_first = MultipleStories(self, "First Stories")
34
+ self.multiple_choices_second = MultipleChoices(self, "Second Multiple Choices")
35
+ self.multiple_stories_second = MultipleStories(self, "Second Stories")
36
+ self.scriptures_ = MultipleStories(self, "Scriptures")
37
+ self.button = SaveDeleteButton(self,
38
+ {
39
+ "save": self.save_formats,
40
+ "delete": self.delete_zipfile
41
+ }
42
+ )
43
+ self.bind_all("<Control-d>", self.stories_delete)
44
+ self.name_to_save = None
45
+
46
+ def _begin_story(self):
47
+ if bg := self.beginning.format_begin():
48
+ self.stories["stories"]["begin"] = bg["begin"]
49
+
50
+ def _multiple_stories(self):
51
+ self._begin_story()
52
+ if isinstance(self.stories["stories"]["begin"], str):
53
+ if ms := self.multiple_stories_first.format_stories():
54
+ self.stories["stories"]["first"] = ms
55
+ if ms := self.multiple_stories_second.format_stories():
56
+ self.stories["stories"]["second"] = ms
57
+ del ms
58
+
59
+ def checking_multiple_stories(self):
60
+ self._multiple_stories()
61
+ check = [
62
+ isinstance(self.stories["stories"]["begin"], str),
63
+ isinstance(self.stories["stories"]["first"], dict),
64
+ isinstance(self.stories["stories"]["second"], dict)
65
+ ]
66
+ return all(check)
67
+
68
+ def _multiple_choices(self):
69
+ if mc := self.multiple_choices_first.format_choices():
70
+ self.choices["choices"]["first"] = mc
71
+ if mc := self.multiple_choices_second.format_choices():
72
+ self.choices["choices"]["second"] = mc
73
+ del mc
74
+
75
+ def checking_multiple_choices(self):
76
+ self._multiple_choices()
77
+ check = [
78
+ isinstance(self.choices["choices"]["first"], dict),
79
+ isinstance(self.choices["choices"]["second"], dict)
80
+ ]
81
+ return all(check)
82
+
83
+ def _scriptures(self):
84
+ if sc := self.scriptures_.format_stories():
85
+ self.scriptures["scriptures"] = sc
86
+
87
+ def checking_scriptures(self):
88
+ self._scriptures()
89
+ return isinstance(self.scriptures["scriptures"], dict)
90
+
91
+ def checking_dir(self):
92
+ if not self.path.exists():
93
+ with chdir(self.path.parent):
94
+ Path("StoryMaker").mkdir()
95
+
96
+ def _reload_combo(self, load: bool = True):
97
+ if load:
98
+ self.combo_stories.reload()
99
+ self.path = self.combo_stories.path
100
+
101
+ def save_formats(self):
102
+ checking = [
103
+ self.checking_multiple_stories(),
104
+ self.checking_multiple_choices(),
105
+ self.checking_scriptures()
106
+ ]
107
+ if not self.combo_stories.checking_dir():
108
+ if all(checking):
109
+ self._reload_combo(False)
110
+ confirm = (
111
+ messagebox.askyesno(
112
+ "Story Maker", f"Save with same file name {self.name_to_save}", parent=self
113
+ )
114
+ if self.name_to_save else False
115
+ )
116
+ ask = (
117
+ simpledialog.askstring("Story Maker", "Name of file:", parent=self)
118
+ if not confirm else
119
+ self.name_to_save
120
+ )
121
+ if ask:
122
+ data = [self.stories, self.choices, self.scriptures]
123
+ archive = StoryFilesArchive(self.path, *data)
124
+ with chdir(self.path):
125
+ archive.archiving_zip(ask)
126
+ del data, archive
127
+ messagebox.showinfo(
128
+ "Story Maker", f"{self.path.joinpath(ask)}.zip file has been created!", parent=self
129
+ )
130
+ self._reload_combo()
131
+ else:
132
+ ask = (simpledialog.askstring("Story Maker", "Name of folder:", parent=self))
133
+ if ask:
134
+ if not self.path.joinpath(ask).is_dir():
135
+ with chdir(self.path):
136
+ Path(ask).mkdir()
137
+ self._reload_combo()
138
+
139
+ def load_formats(self, event=None):
140
+ if not self.combo_stories.checking_dir():
141
+ ask = self.combo_stories.combo_stories.get()
142
+ self._reload_combo(False)
143
+ self.stories_delete()
144
+ if ask and self.path.joinpath(f"{ask}.zip").exists():
145
+ stores = []
146
+ with chdir(self.path):
147
+ stores.extend(StoryFilesLoads(self.path).data_extract(ask))
148
+ self.beginning.insert_text({"begin": stores[0]["stories"]["begin"]})
149
+ self.multiple_choices_first.insert_text(stores[1]["choices"]["first"])
150
+ self.multiple_stories_first.insert_text(stores[0]["stories"]["first"])
151
+ self.multiple_choices_second.insert_text(stores[1]["choices"]["second"])
152
+ self.multiple_stories_second.insert_text(stores[0]["stories"]["second"])
153
+ self.scriptures_.insert_text(stores[2]["scriptures"])
154
+ self.name_to_save = ask
155
+ del stores
156
+
157
+ def stories_delete(self, event=None):
158
+
159
+ self.beginning.delete_text()
160
+ self.multiple_choices_first.delete_all()
161
+ self.multiple_stories_first.delete_all()
162
+ self.multiple_choices_second.delete_all()
163
+ self.multiple_stories_second.delete_all()
164
+ self.scriptures_.delete_all()
165
+
166
+ def delete_zipfile(self):
167
+
168
+ if not self.combo_stories.checking_dir():
169
+ if file := self.combo_stories.combo_stories.get():
170
+ ask = messagebox.askokcancel(
171
+ "Story Maker", f"Do you want to delete this {file}.zip file?", parent=self
172
+ )
173
+ if ask:
174
+ self._reload_combo(False)
175
+ check_path = StoryFilesArchive(self.path)
176
+ file_path = check_path.path.joinpath(f"{file}.zip")
177
+ if file_path.exists():
178
+ check_path.delete_zipfile(file)
179
+ messagebox.showinfo("Story Maker", f"{file_path} has been deleted!")
180
+ self._reload_combo()
181
+ self.name_to_save = None
182
+ del check_path, file_path
183
+ del ask
184
+ elif not self.combo_stories.combo_values():
185
+ self.combo_stories.del_folder()
186
+ self._reload_combo()
187
+ del file
188
+
189
+
190
+ def story_maker():
191
+ MainFrame().mainloop()
@@ -0,0 +1,4 @@
1
+ from .story_data import StoryFilesData
2
+ from .story_archive import StoryFilesArchive
3
+ from .story_load import StoryFilesLoads
4
+ from .choices import Choices
@@ -0,0 +1,14 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © kakkarja (K A K)
3
+
4
+ from enum import StrEnum
5
+
6
+
7
+ class Choices(StrEnum):
8
+ A = "A"
9
+ B = "B"
10
+ C = "C"
11
+
12
+ if __name__ == "__main__":
13
+ c = Choices("A")
14
+ print(f"{c}")
@@ -0,0 +1,123 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © kakkarja (K A K)
3
+
4
+ import json
5
+ import os
6
+ from pathlib import Path
7
+ from zipfile import is_zipfile, ZipFile
8
+ try:
9
+ from .story_data import StoryFilesData
10
+ except:
11
+ from story_data import StoryFilesData
12
+
13
+ """
14
+ 3 Files:
15
+ - stories
16
+ - choices
17
+ - scriptures
18
+
19
+ These files are json formats:
20
+ Stories -
21
+ {"stories": {
22
+ "begin": "......",
23
+ "first": {
24
+ "A": ".....",
25
+ "B": ".....",
26
+ "C": ".....",
27
+ },
28
+ "second": {
29
+ "A": ".....",
30
+ "B": ".....",
31
+ "C": ".....",
32
+ }
33
+ }
34
+ }
35
+
36
+ Choices -
37
+ {"choices":
38
+ {
39
+ "first": {
40
+ "A": ".....",
41
+ "B": ".....",
42
+ "C": ".....",
43
+ },
44
+ "second": {
45
+ "A": ".....",
46
+ "B": ".....",
47
+ "C": ".....",
48
+ }
49
+ }
50
+ }
51
+
52
+ Scriptures -
53
+ {"scriptures":
54
+ {
55
+ "A": ".....",
56
+ "B": ".....",
57
+ }
58
+ }
59
+ """
60
+
61
+ class StoryFilesArchive(StoryFilesData):
62
+ """Archiving files of Stories, with Json format"""
63
+
64
+ def __init__(self, path: str, *args):
65
+ if args:
66
+ super().__init__(*args)
67
+ else:
68
+ super().__init__(None, None, None)
69
+ self.path = Path(path)
70
+
71
+
72
+ def creating_files(self) -> list[str]:
73
+ """Creating json files for each story"""
74
+
75
+ files = {"stories": self.stories, "choices": self.choices, "scriptures": self.scriptures}
76
+ list_files = []
77
+ for k, v in files.items():
78
+ pth = self.path.joinpath(f"{k}.json")
79
+ if not pth.exists() and v:
80
+ with open(pth, "w") as story:
81
+ json.dump(v, story)
82
+ list_files.append(pth)
83
+ del pth
84
+ return list_files
85
+
86
+ def deleting_files(self):
87
+ """deleting json files"""
88
+
89
+ files = ["stories", "choices", "scriptures"]
90
+ for file in files:
91
+ pth = self.path.joinpath(f"{file}.json")
92
+ if pth.exists():
93
+ os.remove(pth)
94
+ del pth
95
+ del files
96
+
97
+ def archiving_zip(self, name: str):
98
+ """Archiving story to a zip file for loading or deleting all json files"""
99
+
100
+ if files := self.creating_files():
101
+ if not is_zipfile(self.path.joinpath(f"{name}.zip")):
102
+ with ZipFile(self.path.joinpath(f"{name}.zip"), "x") as zipped:
103
+ for file in files:
104
+ zipped.write(file.name)
105
+ else:
106
+ with ZipFile(self.path.joinpath(f"{name}.zip"), "w") as zipped:
107
+ for file in files:
108
+ zipped.write(file.name)
109
+ self.deleting_files()
110
+
111
+ def unarchived_zip(self, name: str):
112
+ """Extracting file from a zip file"""
113
+
114
+ if is_zipfile(self.path.joinpath(f"{name}.zip")):
115
+ with ZipFile(self.path.joinpath(f"{name}.zip")) as zipped:
116
+ for file in zipped.filelist:
117
+ zipped.extract(file)
118
+
119
+ def delete_zipfile(self, name: str):
120
+ """Deleting a zip file"""
121
+
122
+ if is_zipfile(self.path.joinpath(f"{name}.zip")):
123
+ os.remove(self.path.joinpath(f"{name}.zip"))
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © kakkarja (K A K)
3
+
4
+
5
+ class StoryFilesData:
6
+
7
+ def __init__(self, stories: dict[str, str], choices: dict[str, str], scriptures: dict[str, str]):
8
+ self.stories = stories
9
+ self.choices = choices
10
+ self.scriptures = scriptures
@@ -0,0 +1,61 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © kakkarja (K A K)
3
+
4
+ import json
5
+ import os
6
+ from pathlib import Path
7
+ try:
8
+ from .story_archive import StoryFilesArchive
9
+ except:
10
+ from story_archive import StoryFilesArchive
11
+
12
+
13
+ class StoryFilesLoads(StoryFilesArchive):
14
+ """Story loader"""
15
+
16
+ def _folder_files(self, name: str) -> None:
17
+ """Unarchived zipfile to a folder"""
18
+
19
+ pth = self.path.joinpath(name)
20
+ if not pth.exists():
21
+ self.unarchived_zip(name)
22
+ pth.mkdir()
23
+ files = ["stories", "choices", "scriptures"]
24
+ for file in files:
25
+ p = self.path.joinpath(f"{file}.json")
26
+ p.rename(pth.joinpath(p.name))
27
+ del p
28
+ del files
29
+ del pth
30
+
31
+ def data_extract(self, name: str) -> list:
32
+ """Extracted data individually to a list"""
33
+
34
+ self._folder_files(name)
35
+ datas = []
36
+ files = ["stories", "choices", "scriptures"]
37
+ for file in files:
38
+ p = self.path.joinpath(name, f"{file}.json")
39
+ with open(p) as d:
40
+ datas.append(json.load(d))
41
+ os.remove(p)
42
+ os.rmdir(self.path.joinpath(name))
43
+ del files
44
+ return datas
45
+
46
+
47
+ if __name__ == "__main__":
48
+
49
+ path = Path(__file__).parent
50
+ #os.chdir(path=path)
51
+ # data = [{"Stories": "..."}, {"choices": "..."}, {"scriptures": "..."}]
52
+ # story = StoryFilesArchive(path, *data)
53
+ # story.archiving_zip("test")
54
+ # story.unarchived_zip("test")
55
+ # story.deleting_files()
56
+
57
+ # loadstory = StoryFilesArchive(path)
58
+ # loadstory.unarchived_zip("test")
59
+ # loadstory.deleting_files()
60
+ # StoryFilesArchive(path).deleting_files()
61
+ #print(*StoryFilesLoads(path).data_extract("test"))
@@ -0,0 +1,7 @@
1
+ from .story_beginning import BeginningStory
2
+ from .story_multiple_choices import MultipleChoices
3
+ from .story_multiple_stories import MultipleStories
4
+ from .story_save_delete_button import SaveDeleteButton
5
+ from .story_selection import StorySelection
6
+
7
+ __all__ = [""]
@@ -0,0 +1,34 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © kakkarja (K A K)
3
+
4
+ from tkinter import ttk, Text
5
+
6
+ __all__ = [""]
7
+
8
+
9
+ class BeginningStory(ttk.LabelFrame):
10
+ """Beginning of story"""
11
+
12
+ def __init__(self, root):
13
+ super().__init__()
14
+
15
+ self.config(text="Beginning of a story")
16
+ self.pack(fill="both", expand=1)
17
+ self.frame_top = ttk.Frame(self)
18
+ self.frame_top.pack(fill="both", expand=1)
19
+ self.begin = Text(self.frame_top, height=1, wrap="word")
20
+ self.begin.pack(side="left", fill="both", expand=1)
21
+ self.scrollbar = ttk.Scrollbar(self.frame_top, orient="vertical", command=self.begin.yview)
22
+ self.begin.configure(yscrollcommand=self.scrollbar.set)
23
+ self.scrollbar.pack(side="right", fill="y")
24
+
25
+ def format_begin(self) -> (dict[str, str] | None):
26
+ if self.begin.get("1.0", "end")[:-1]:
27
+ return {"begin": self.begin.get("1.0", "end")[:-1].strip()}
28
+
29
+ def delete_text(self):
30
+ self.begin.delete("1.0", "end")
31
+
32
+ def insert_text(self, format_: dict[str|str]):
33
+ self.delete_text()
34
+ self.begin.insert("1.0", format_["begin"])
@@ -0,0 +1,58 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © kakkarja (K A K)
3
+
4
+ from tkinter import ttk
5
+
6
+ __all__ = [""]
7
+
8
+
9
+ class MultipleChoices(ttk.LabelFrame):
10
+ """Multiple Choices"""
11
+
12
+ def __init__(self, root, judul: str):
13
+ super().__init__()
14
+
15
+ self.config(text=judul)
16
+ self.pack(fill="x")
17
+ self.left_frame = ttk.Frame(self)
18
+ self.left_frame.pack(fill="x", expand=1)
19
+
20
+ self.lif_left_choice = ttk.LabelFrame(self.left_frame, text="A", labelanchor="w")
21
+ self.lif_left_choice.pack(side="left", fill="x", expand=1)
22
+ self.entry_a = ttk.Entry(self.lif_left_choice)
23
+ self.entry_a.pack(fill="x", expand=1)
24
+
25
+ self.lif_mid_choice = ttk.LabelFrame(self.left_frame, text="B", labelanchor="w")
26
+ self.lif_mid_choice.pack(side="left", fill="x", expand=1)
27
+ self.entry_b = ttk.Entry(self.lif_mid_choice)
28
+ self.entry_b.pack(fill="x", expand=1)
29
+
30
+ self.lif_right_choice = ttk.LabelFrame(self.left_frame, text="C", labelanchor="w")
31
+ self.lif_right_choice.pack(side="left", fill="x", expand=1)
32
+ self.entry_c = ttk.Entry(self.lif_right_choice)
33
+ self.entry_c.pack(fill="x", expand=1)
34
+
35
+ def format_choices(self) -> (dict[str, str] | None):
36
+
37
+ entries = [self.entry_a.get().strip(), self.entry_b.get().strip(), self.entry_c.get().strip()]
38
+
39
+ if all(entries):
40
+ return {
41
+ "A": entries[0],
42
+ "B": entries[1],
43
+ "C": entries[2],
44
+ }
45
+
46
+ def delete_all(self):
47
+ entries = [self.entry_a, self.entry_b, self.entry_c]
48
+ for entry in entries:
49
+ entry.delete(0, "end")
50
+ del entries
51
+
52
+ def insert_text(self, format_: dict[str|str]):
53
+ self.delete_all()
54
+ entries = [self.entry_a, self.entry_b, self.entry_c]
55
+ texts = [format_["A"], format_["B"], format_["C"]]
56
+ for entry, text in zip(entries, texts):
57
+ entry.insert(0, text)
58
+ del entries, text
@@ -0,0 +1,77 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © kakkarja (K A K)
3
+
4
+ from tkinter import ttk, Text
5
+
6
+ __all__ = [""]
7
+
8
+
9
+ class MultipleStories(ttk.LabelFrame):
10
+ """Multiple Stories Results"""
11
+
12
+ def __init__(self, root, judul: str):
13
+ super().__init__()
14
+
15
+ self.config(text=judul)
16
+ self.pack(fill="both", expand=1)
17
+ self.left_frame = ttk.Frame(self)
18
+ self.left_frame.pack(fill="both", expand=1)
19
+
20
+ self.lif_left_choice = ttk.LabelFrame(self.left_frame, text="A", labelanchor="w")
21
+ self.lif_left_choice.pack(fill="both", expand=1)
22
+ self.text_a = Text(self.lif_left_choice, height=1, wrap="word")
23
+ self.text_a.pack(side="left", fill="both", expand=1)
24
+ self.scrollbar = ttk.Scrollbar(self.lif_left_choice, orient="vertical", command=self.text_a.yview)
25
+ self.text_a.configure(yscrollcommand=self.scrollbar.set)
26
+ self.scrollbar.pack(side="right", fill="y")
27
+
28
+ self.lif_mid_choice = ttk.LabelFrame(self.left_frame, text="B", labelanchor="w")
29
+ self.lif_mid_choice.pack(fill="both", expand=1)
30
+ self.text_b = Text(self.lif_mid_choice, height=1, wrap="word")
31
+ self.text_b.pack(side="left", fill="both", expand=1)
32
+ self.scrollbar = ttk.Scrollbar(self.lif_mid_choice, orient="vertical", command=self.text_b.yview)
33
+ self.text_b.configure(yscrollcommand=self.scrollbar.set)
34
+ self.scrollbar.pack(side="right", fill="y")
35
+
36
+ self.lif_right_choice = ttk.LabelFrame(self.left_frame, text="C", labelanchor="w")
37
+ self.lif_right_choice.pack(fill="both", expand=1)
38
+ self.text_c = Text(self.lif_right_choice, height=1, wrap="word")
39
+ self.text_c.pack(side="left", fill="both", expand=1)
40
+ self.scrollbar = ttk.Scrollbar(self.lif_right_choice, orient="vertical", command=self.text_c.yview)
41
+ self.text_c.configure(yscrollcommand=self.scrollbar.set)
42
+ self.scrollbar.pack(side="right", fill="y")
43
+
44
+ def format_stories(self) -> (dict[str, str] | None):
45
+
46
+ stories = [
47
+ self.text_a.get("1.0", "end")[:-1].strip(),
48
+ self.text_b.get("1.0", "end")[:-1].strip(),
49
+ self.text_c.get("1.0", "end")[:-1].strip(),
50
+ ]
51
+ if all(stories):
52
+ return {
53
+ "A": stories[0],
54
+ "B": stories[1],
55
+ "C": stories[2],
56
+ }
57
+
58
+ def delete_all(self):
59
+ stories = [
60
+ self.text_a, self.text_b, self.text_c,
61
+ ]
62
+ for story in stories:
63
+ story.delete("1.0", "end")
64
+ del stories
65
+
66
+ def insert_text(self, format_: dict[str|str]):
67
+ self.delete_all()
68
+ stories = [
69
+ self.text_a, self.text_b, self.text_c,
70
+ ]
71
+ sentences = [
72
+ format_.get("A"), format_.get("B"), format_.get("C")
73
+ ]
74
+ for story, sentence in zip(stories, sentences):
75
+ if sentence:
76
+ story.insert("1.0", sentence)
77
+ del stories, sentences
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © kakkarja (K A K)
3
+
4
+ from tkinter import ttk
5
+ from typing import Any
6
+
7
+ __all__ = [""]
8
+
9
+
10
+ class SaveDeleteButton(ttk.Frame):
11
+ """Saving Button with 2 commands for Save and Load buttons, with defaults empty"""
12
+
13
+ def __init__(self, root, command: dict[str, Any] = {"save": "", "delete": ""}):
14
+ super().__init__()
15
+
16
+ self.pack(fill="both")
17
+ self.button_frame = ttk.Frame(self)
18
+ self.button_frame.pack(fill="both")
19
+
20
+ self.save = ttk.Button(self.button_frame,text="Save", command=command["save"],)
21
+ self.save.pack(side="left", ipadx=2, ipady=2, fill="both", expand=1)
22
+
23
+ # self.save = ttk.Button(self.button_frame,text="Load", command=command["load"],)
24
+ # self.save.pack(side="left", ipadx=2, ipady=2, fill="both", expand=1)
25
+
26
+ self.save = ttk.Button(self.button_frame,text="Delete", command=command["delete"],)
27
+ self.save.pack(side="left", ipadx=2, ipady=2, fill="both", expand=1)
@@ -0,0 +1,99 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © kakkarja (K A K)
3
+
4
+ from tkinter import ttk
5
+ from pathlib import Path
6
+ from typing import Any
7
+
8
+
9
+ class StorySelection(ttk.Frame):
10
+
11
+ def __init__(self, root, path: Path):
12
+ super().__init__()
13
+ self.path = path
14
+
15
+ self.pack(fill="both")
16
+ self.combo_frame = ttk.Frame(self)
17
+ self.combo_frame.pack(fill="both")
18
+
19
+ self.combo_stories = ttk.Combobox(self.combo_frame, width = 30)
20
+ self.combo_stories.pack(side="top", pady=1)
21
+ self.combo_stories.bind("<<ComboboxSelected>>", self.combo_select)
22
+ self.combo_stories["value"] = [
23
+ directory.name for directory in self.path.iterdir() if directory.is_dir()
24
+ ]
25
+ self.style = ttk.Style()
26
+ self.style.configure('my.TButton', font=('Helvetica', 20, "bold"), width=1)
27
+ self.button_frame = ttk.Frame(self)
28
+ self.button_frame.pack()
29
+ self.back_button = ttk.Button(self.button_frame, text="<", style="my.TButton", command=self.previous_folder)
30
+ self.back_button.pack(side="left", padx=(0, 2))
31
+ self.fwd_button = ttk.Button(self.button_frame, text=">", style="my.TButton", command=self.selected_folder)
32
+ self.fwd_button.pack(side="left")
33
+ self.folder = None
34
+
35
+ def _reload_combo(self, folder: Path, file: bool = True):
36
+ self.combo_stories.delete(0, "end")
37
+ val = [
38
+ file.name[:-4] for file in folder.iterdir() if ".zip" in file.name
39
+ ] if file else [
40
+ directory.name for directory in folder.iterdir() if directory.is_dir()
41
+ ]
42
+ self.combo_stories["value"] = val
43
+ self.path = folder
44
+
45
+ def _read_only(self, read: bool = True):
46
+ if read:
47
+ self.combo_stories.config(state="readonly")
48
+ else:
49
+ self.combo_stories.config(state="normal")
50
+
51
+ def combo_select(self, event=None):
52
+ if folder := self.combo_stories.get():
53
+ if self.path.joinpath(folder).is_dir():
54
+ self._reload_combo(self.path.joinpath(folder))
55
+ self._read_only()
56
+ self.folder = folder
57
+ del folder
58
+
59
+ def previous_folder(self):
60
+ if self.folder:
61
+ if self.path.name == self.folder:
62
+ self._read_only(False)
63
+ self._reload_combo(self.path.parent, False)
64
+
65
+ def selected_folder(self):
66
+ if self.folder:
67
+ if self.path.joinpath(self.folder).is_dir():
68
+ self._reload_combo(self.path.joinpath(self.folder))
69
+ self._read_only()
70
+
71
+ def checking_dir(self):
72
+ if self.path.name == "StoryMaker":
73
+ return True
74
+ return False
75
+
76
+ def _state_combo_read(self):
77
+ if str(self.combo_stories.cget("state")) == "readonly":
78
+ return True
79
+ return False
80
+
81
+ def reload(self):
82
+ if self.checking_dir():
83
+ if self._state_combo_read():
84
+ self._read_only(False)
85
+ self._reload_combo(self.path, False)
86
+ else:
87
+ if self._state_combo_read():
88
+ self._read_only(False)
89
+ self._reload_combo(self.path)
90
+ self._read_only()
91
+
92
+ def combo_values(self):
93
+ return bool(self.combo_stories["value"])
94
+
95
+ def del_folder(self):
96
+ if self.folder and self.path.name == self.folder:
97
+ if not self.combo_values():
98
+ self.path.rmdir()
99
+ self.path = self.path.parent