Skip to content

Commit

Permalink
Prevent Settings window from openning multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
4rtzel committed Feb 13, 2022
1 parent e8158f9 commit 0efa155
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions poe_arch_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ def __init__(self, root, items_map, image_scanner):
self._root = root
self._items_map = items_map
self._image_scanner = image_scanner
self._window = None

self._config = ConfigParser()
self._config_file = 'settings.ini'
Expand All @@ -497,6 +498,8 @@ def __init__(self, root, items_map, image_scanner):


def show(self) -> None:
if self._window is not None:
return
self._window = tk.Toplevel()

self._window.geometry('+100+200')
Expand Down Expand Up @@ -534,7 +537,9 @@ def show(self) -> None:
c.select()

def _close(self) -> None:
self._window.destroy()
if self._window is not None:
self._window.destroy()
self._window = None

def _save_config(self) -> None:
self._config['settings']['scanner_window'] = str(self._image_scanner.scanner_window_size)
Expand Down Expand Up @@ -637,4 +642,4 @@ def calculate_default_scale(info: PoeWindowInfo) -> float:
image_scanner = ImageScanner(info, items_map)

overlay = UIOverlay(root, info, items_map, image_scanner)
overlay.run()
overlay.run()

0 comments on commit 0efa155

Please sign in to comment.