-
Notifications
You must be signed in to change notification settings - Fork 9
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 #257 from tangkong/perf_cli2
PERF: refactor atef.bin cli entrypoint to defer imports (try 2)
- Loading branch information
Showing
11 changed files
with
978 additions
and
901 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
`atef config` opens up a graphical config file editor. | ||
""" | ||
import logging | ||
import sys | ||
from typing import List, Optional | ||
|
||
from pydm import exception | ||
from qtpy.QtWidgets import QApplication | ||
|
||
from ..type_hints import AnyPath | ||
from ..widgets.config.window import Window | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def main(cache_size: int, filenames: Optional[List[AnyPath]] = None, **kwargs): | ||
app = QApplication(sys.argv) | ||
main_window = Window(cache_size=cache_size, show_welcome=not filenames) | ||
main_window.show() | ||
exception.install() | ||
|
||
for filename in filenames or []: | ||
try: | ||
main_window.open_file(filename=filename) | ||
except FileNotFoundError: | ||
logger.error( | ||
"File specified on the command-line not found: %s", filename | ||
) | ||
|
||
app.exec() |
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
Oops, something went wrong.