Skip to content

Commit

Permalink
DocuPort PSG Update
Browse files Browse the repository at this point in the history
> v2.2.1b -> v2.3.1b

---

GUI Changes:

- Lines 124-128 refactored with the following changes:
    - Remove unnecessary call to keys() (remove-dict-keys)
    - Replace multiple comparisons of same variable with in operator (merge-comparisons)
- Implemented second dynamic text-change upon opening a web-page.
- Changed color theme text.

---

CLI Version Changes:

- Fixed bug that displayed incorrect number of potential choices.
- Formatting changes.

---

Other:

- Expanded function in-line documentation.
- Added better text-formatting to README (italics, bolds where necessary).
- Various small README text adjustments.
- Updated screenshots in README.

Signed-off-by: schlopp96 <[email protected]>
  • Loading branch information
schlopp96 committed Aug 10, 2021
1 parent c9813bc commit 965212a
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 26 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,4 @@ dmypy.json
cython_debug/

# X-Session COMMIT TAG Notes
tag-notes.txt

# "Scrap" files
scrap.py
tag-notes.txt
Binary file modified DP_PSG_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified DP_PSG_screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,40 @@
---

> - _A PySimpleGUI Online Documentation Portal_
> - v2.2.0-Beta
> - v2.3.1-Beta
[PySimpleGUI](https://pysimplegui.readthedocs.io/en/latest/) is an _excellent_ framework for building GUIs quickly, and with ease. Unfortunately, PSG doesn't have any _official_ offline documentation that can be easily downloaded. Instead, the documentation is hosted _online_, where it is changed and updated quite frequently - which is part of the reason the creator maintains the documentation online only.
[PySimpleGUI](https://pysimplegui.readthedocs.io/en/latest/) is an _excellent_ framework for building GUIs quickly, and with ease. Unfortunately, **_PSG_** doesn't have any _official_ offline documentation that can be easily downloaded. Instead, the documentation is hosted _online_, where it is changed and updated quite frequently - which is part of the reason the creator maintains the documentation online only.

As a result, users must go online anytime the documentation is needed, which is rather often as stated by the dev(s) themselves. So I decided to create a simple application that can
take users to specific areas of the online documentation quickly, and with the click of a
button. Thus, out of my own laziness and disdain for digging through webpages, **DocuPort PSG** was born!

---

## How to use DocuPort PSG - **GUI**
## How to use DocuPort PSG - **GUI Version**

---

- Using the application is about as simple can be:
- _Using the application is about as simple can be:_

- Simply open the application, and choose a section to browse.
- _The color scheme of the window will be different each time the window is opened._
- Click on the desired section, and the app will open the documentation in your default browser automatically.
- You can open as many pages/chapters as you\'d like, and the app will remain open.
- You can open as many pages/chapters as you wish, and the app will remain open.
- ***DocuPort PSG*** is always shown on top of other open windows to prevent the need to continuously minimize/maximize/re-size/close your browser window when researching through _multiple_ sections.
- To exit or close the app, simply click the "X" at the top of the screen, or the "Exit" button at the bottom of the window.
- That's it!
- ***That's it!***

- ![DocuPort PSG](DP_PSG_screenshot.png)
- ![DocuPort PSG](DP_PSG_screenshot2.png)

---

## How to use DocuPort PSG - **CLI**
## How to use DocuPort PSG - **CLI Version**

---

> _Introduced with v2.0.1 update_
> _Introduced in v2.0.1-Beta update_
- The command-line-interface version of the application is entirely self explanatory through on-screen directions.
- Simply follow the instructions displayed on screen, and you'll be fine!
Expand Down
32 changes: 19 additions & 13 deletions src/DocuPort_PSG.pyw
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# #& DocuPort PSG v2.2.0-Beta
# #& DocuPort PSG v2.3.1-Beta
#? Simple GUI Script to open user-specified chapter of the Online-Documentation for PySimpleGUI.
#? =============================== Libraries =============================== ?#
from random import choice as rChoice
Expand All @@ -17,9 +17,11 @@ sg.theme(theme)
def open_PSGUI(title: str, url: str) -> bool:
"""Open a specific PySimpleGUI documentation section in the user's default browser.
:param title: | title of the documentation-section selected.
:param url: | section URL to open in the user's default browser.
:param title: title of the documentation-section selected.
:type title: (str)
:param url: section URL to open in the user's default browser.
:type url: (str)
:returns: opens new page/tab in browser.
:rtype: None
"""
window_MAIN['-TEXT_TOP-'].Update(f'Opening Doc Section: {title}')
Expand Down Expand Up @@ -103,7 +105,7 @@ winlayout = [
#* Exit Button
[sg.Exit(tooltip='Exit the program.')],
#* Small Text to Display Current Theme
[sg.Text(f'Current Theme: {theme}', font='_ 8')]
[sg.Text(f'Current Color Theme: {theme}', font='_ 8')]
]

#~ Displays Window:
Expand All @@ -121,21 +123,25 @@ while True: #* The Infinite Loop that keeps the Window open, and returns feedba
#print(event, values) #NOTE: #? Enable to print stdout to console.

#! Closes Window upon clicking 'x' or sg.Exit() Button.
if (event == sg.WIN_CLOSED or event == 'Exit'):
if event in [sg.WIN_CLOSED, 'Exit']:
break
if event == '-OPEN_URL-':
docs_section: str = values['-OPTION_MENU-']
if docs_section in menu_choices.keys():
action = menu_choices[docs_section]
if docs_section in menu_choices:
choice = menu_choices[docs_section]
#^ If chosen option is a function:
if callable(action):
action()
if callable(choice):
choice()
#* If chosen option is a string:
else:
open_PSGUI(title=docs_section, url=action)
window_MAIN['-TEXT_TOP-'].Update(
'Choose Topic from PySimpleGUI Docs to Browse')
open_PSGUI(title=docs_section, url=choice)
s(1.5)
window_MAIN['-TEXT_TOP-'].Update('Done!')
window_MAIN.Refresh()
s(1)
window_MAIN['-TEXT_TOP-'].Update(
'Choose Topic from PySimpleGUI Docs to Browse')

#! Close program and release computer resources:
window_MAIN.close()
#* ========================================================================= *#
2 changes: 1 addition & 1 deletion src/DocuPort_PSG_CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,5 +235,5 @@ def createMAC() -> None:
ex(0)
else:
inputCount = 0
print('\n- ERROR: -\n> Must Enter an Integer between 1 and 23.\n')
print('\n- ERROR: -\n> Must Enter an Integer between 1 and 22.\n')
s(1)

0 comments on commit 965212a

Please sign in to comment.