Skip to content

Commit 8be0cca

Browse files
committed
Rename variables to improve readability.
1 parent 7a80bac commit 8be0cca

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

tkintermd/frame.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ def __init__(self, master, **kwargs):
102102
self.text_area = self.editor_frame.tbox
103103
self.preview_tabs = Notebook(self.editor_pw)
104104
#make the previews
105-
self.preview_area = HtmlFrame(self.preview_tabs)
105+
self.preview_document = HtmlFrame(self.preview_tabs)
106106

107-
self.preview_html_frame = ScrolledTextBox(self.preview_tabs)
108-
self.preview_html = self.preview_html_frame.tbox
109-
self.preview_tabs.add(self.preview_area, text="Preview Format")
110-
self.preview_tabs.add(self.preview_html_frame, text="Preview HTML code")
107+
self.export_options_frame = ScrolledTextBox(self.preview_tabs)
108+
self.export_options = self.export_options_frame.tbox
109+
self.preview_tabs.add(self.preview_document, text="Preview Document")
110+
self.preview_tabs.add(self.export_options_frame, text="Export Options")
111111
#add the areas to the paned window
112112
self.editor_pw.add(self.editor_frame)
113113
self.editor_pw.add(self.preview_tabs)
@@ -163,7 +163,7 @@ def __init__(self, master, **kwargs):
163163

164164
# # This links the scrollbars but is currently causing issues.
165165
# Changing the settings to make the scrolling work
166-
# self.preview_area.html['yscrollcommand'] = self.on_mousewheel
166+
# self.preview_document.html['yscrollcommand'] = self.on_mousewheel
167167

168168
def popup(self, event):
169169
"""Right-click popup at mouse location within the text area only.
@@ -187,7 +187,7 @@ def popup(self, event):
187187
# """
188188
# self.text_area.yview(*args)
189189
# # # This links the scrollbars but is currently causing issues.
190-
# # self.preview_area.html.yview(*args)
190+
# # self.preview_document.html.yview(*args)
191191

192192
# def on_mousewheel(self, *args):
193193
# """Moves the scrollbar and scrolls the text area on mousewheel event.
@@ -198,7 +198,7 @@ def popup(self, event):
198198
# """
199199
# self.scrollbar.set(*args)
200200
# # # This links the scrollbars but is currently causing issues.
201-
# # self.preview_area.vsb.set(*args)
201+
# # self.preview_document.vsb.set(*args)
202202
# self.on_scrollbar('moveto', args[0])
203203

204204
def select_all(self, *args):
@@ -305,7 +305,7 @@ def save_as_html_file(self):
305305
- If a filename is provided then `try` to open it in "write" mode.
306306
- If any of the above fails then display an error message.
307307
"""
308-
html_file_data = self.preview_html.get("1.0" , END)
308+
html_file_data = self.export_options.get("1.0" , END)
309309
self.html_save_filename = filedialog.asksaveasfilename(filetypes = (("HTML file", ("*.html", "*.htm")),) , title="Save HTML File")
310310
if self.html_save_filename:
311311
try:
@@ -329,10 +329,10 @@ def on_input_change(self, event):
329329
md2html = Markdown(extensions=constants.extensions, extension_configs=constants.extension_configs)
330330
markdownText = self.text_area.get("1.0", END)
331331
html = md2html.convert(markdownText)
332-
self.preview_html.delete("1.0" , END)
333-
self.preview_html.insert(END, html)
334-
self.preview_area.load_html(html)
335-
self.preview_area.add_css(self.css)
332+
self.export_options.delete("1.0" , END)
333+
self.export_options.insert(END, html)
334+
self.preview_document.load_html(html)
335+
self.preview_document.add_css(self.css)
336336
self.check_markdown_highlighting(start="1.0", end=END)
337337
self.text_area.edit_modified(0) # resets the text widget to generate another event when another change occours
338338

@@ -359,25 +359,25 @@ def load_style(self, stylename):
359359
kwargs['font'] = font
360360
kwargs['underline'] = opts['underline']
361361
self.text_area.tag_configure(str(token), **kwargs)
362-
self.preview_html.tag_configure(str(token), **kwargs)
362+
self.export_options.tag_configure(str(token), **kwargs)
363363
self.syntax_highlighting_tags.append(str(token))
364364
# print(self.style.background_color or 'white', self.text_area.tag_cget("Token.Text", "foreground") or 'black', stylename)
365365
self.text_area.configure(bg=self.style.background_color or 'white',
366366
fg=self.text_area.tag_cget("Token.Text", "foreground") or 'black',
367367
selectbackground=self.style.highlight_color,
368368
)
369369
self.text_area.tag_configure(str(Generic.StrongEmph), font=('Monospace', 10, 'bold', 'italic'))
370-
self.preview_html.configure(bg=self.style.background_color or 'white',
371-
fg=self.preview_html.tag_cget("Token.Text", "foreground") or 'black',
370+
self.export_options.configure(bg=self.style.background_color or 'white',
371+
fg=self.export_options.tag_cget("Token.Text", "foreground") or 'black',
372372
selectbackground=self.style.highlight_color,
373373
)
374-
self.preview_html.tag_configure(str(Generic.StrongEmph), font=('Monospace', 10, 'bold', 'italic'))
374+
self.export_options.tag_configure(str(Generic.StrongEmph), font=('Monospace', 10, 'bold', 'italic'))
375375
self.syntax_highlighting_tags.append(str(Generic.StrongEmph))
376376
self.css = 'body {background-color: %s; color: %s}' % (
377377
self.style.background_color or 'white',
378378
self.text_area.tag_cget("Token.Text", "foreground") or 'black',
379379
)# used string%interpolation here because f'string' interpolation is too annoying with embeded { and }
380-
self.preview_area.add_css(self.css)
380+
self.preview_document.add_css(self.css)
381381
return self.syntax_highlighting_tags
382382

383383
def check_markdown_highlighting(self, start='insert linestart', end='insert lineend'):

0 commit comments

Comments
 (0)