Skip to content

Commit

Permalink
Changed some things (#46)
Browse files Browse the repository at this point in the history
* Changed some things
* See the changelog.
  • Loading branch information
Prayag2 authored Oct 24, 2021
1 parent a31dfc0 commit 0c23d33
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ dmypy.json
cython_debug/

# VS Code
.vscode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.1.1] - 2021-10-24
### Removed
- Removed the prompt that asked you which desktop environment you use when you ran Konsave for the first time. See [#45](https://github.com/Prayag2/konsave/issues/45).
- Removed unused import of the `log` function in `__main__.py`.

### Changed
- Konsave will now automatically detect if you're using KDE plasma or not.
- Fixed some Pylint errors.

## [2.1.0] - 2021-09-07
### Added
- The following placeholders for `config.yaml` were added:
Expand Down Expand Up @@ -159,6 +168,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- You can also import ".knsv" files as profiles!


[2.1.1]: https://github.com/Prayag2/konsave/compare/v2.1.0...v2.1.1
[2.1.0]: https://github.com/Prayag2/konsave/compare/v2.0.2...v2.1.0
[2.0.2]: https://github.com/Prayag2/konsave/compare/v2.0.1...v2.0.2
[2.0.1]: https://github.com/Prayag2/konsave/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/Prayag2/konsave/compare/v1.1.9...v2.0.0
[1.1.9]: https://github.com/Prayag2/konsave/compare/v1.1.8...v1.1.9
[1.1.8]: https://github.com/Prayag2/konsave/compare/v1.1.7...v1.1.8
Expand Down
21 changes: 5 additions & 16 deletions konsave/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
export,
import_profile,
wipe,
log,
)
from konsave.consts import (
VERSION,
Expand Down Expand Up @@ -101,22 +100,12 @@ def main():
"""The main function that handles all the arguments and options."""

if not os.path.exists(CONFIG_FILE):
log("Select your desktop environment-")
try:
desktop_environment = int(input("1. KDE Plasma\n2. Other\n=>"))
except ValueError:
log("Invalid input.")
return
if os.path.expandvars("$XDG_CURRENT_DESKTOP") == "KDE":
default_config_path = resource_filename("konsave", "conf_kde.yaml")
shutil.copy(default_config_path, CONFIG_FILE)
else:
if desktop_environment == 1:
default_config_path = resource_filename("konsave", "conf_kde.yaml")
shutil.copy(default_config_path, CONFIG_FILE)
elif desktop_environment == 2:
default_config_path = resource_filename("konsave", "conf_other.yaml")
shutil.copy(default_config_path, CONFIG_FILE)
else:
log("Invalid input.")
return
default_config_path = resource_filename("konsave", "conf_other.yaml")
shutil.copy(default_config_path, CONFIG_FILE)

parser = _get_parser()
args = parser.parse_args()
Expand Down
4 changes: 2 additions & 2 deletions konsave/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def exception_handler(func):
def inner_func(*args, **kwargs):
try:
function = func(*args, **kwargs)
except Exception as error:
except Exception as err:
dateandtime = datetime.now().strftime("[%d/%m/%Y %H:%M:%S]")
log_file = os.path.join(HOME, "konsave_log.txt")

Expand All @@ -48,7 +48,7 @@ def inner_func(*args, **kwargs):
file.write("\n")

print(
f"Konsave: {error}\nPlease check the log at {log_file} for more details."
f"Konsave: {err}\nPlease check the log at {log_file} for more details."
)
return None
else:
Expand Down
4 changes: 2 additions & 2 deletions konsave/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def parse_functions(tokens_, token_symbol, parsed):
"HOME": HOME,
"CONFIG_DIR": CONFIG_DIR,
"SHARE_DIR": SHARE_DIR,
"BIN_DIR": BIN_DIR
}
"BIN_DIR": BIN_DIR,
}
},
"functions": {
"raw_regex": r"\{\w+\=(?:\"|')\S+(?:\"|')\}",
Expand Down

0 comments on commit 0c23d33

Please sign in to comment.