forked from computerlyrik/dymoprint
-
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.
Merge pull request computerlyrik#108 from tomers/tomer_fixes
Tomer fixes
- Loading branch information
Showing
20 changed files
with
203 additions
and
109 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
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
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 |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
.Python | ||
env/ | ||
bin/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
var/ | ||
|
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .labeler import DymoLabeler | ||
from .metadata import __version__ | ||
from dymoprint.lib.labeler import DymoLabeler | ||
from dymoprint.metadata import __version__ | ||
|
||
__all__ = ["__version__", "DymoLabeler"] |
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
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,33 @@ | ||
from configparser import ConfigParser | ||
from pathlib import Path | ||
|
||
from platformdirs import user_config_dir | ||
|
||
|
||
class SectionNotFound(Exception): | ||
def __init__(self, config_file_path, section_name): | ||
msg = f"Section {section_name} not fount in {config_file_path}" | ||
super().__init__(msg) | ||
|
||
|
||
class ConfigFile: | ||
_CONFIG_FILE_PATH = Path(user_config_dir()) / "dymoprint.ini" | ||
_config_parser = None | ||
|
||
def __init__(self): | ||
config_parser = ConfigParser() | ||
if config_parser.read(self._CONFIG_FILE_PATH): | ||
self._config_parser = config_parser | ||
|
||
def section(self, section_name): | ||
"""Return the given config file section as dict.""" | ||
if self._config_parser: | ||
try: | ||
return dict(self._config_parser[section_name]) | ||
except KeyError: | ||
raise SectionNotFound(self._CONFIG_FILE_PATH, section_name) from None | ||
return None | ||
|
||
@property | ||
def fonts_section(self): | ||
return self.section("FONTS") |
Oops, something went wrong.