Skip to content

Commit

Permalink
fixed settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihail-Cosmin Munteanu committed Oct 7, 2022
1 parent a135958 commit 5aca4d2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions monkeyshot/monkeyshot.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class MonkeyHouse:
self.last_click_y = 0
self.region = None
self.settings_w = None
self._init_settings()
self.main_window()

@staticmethod
Expand All @@ -160,9 +161,17 @@ class MonkeyHouse:
return settings_dict

@staticmethod
def save_settings_file(settings_dict: dict):
def _init_settings():
if not isfile(join(WORKING_DIR, "settings.xml")):
with open(join(WORKING_DIR, "settings.xml"), "w", encoding="utf-8") as settings_file:
settings_file.write("<Settings>\n")
settings_file.write(f" <AudioDevice>{get_audio_devices()[0]}</AudioDevice>\n")
settings_file.write(f" <VideoDevice>{get_video_devices()[0]}</VideoDevice>\n")
settings_file.write("</Settings>")

def save_settings_file(self, settings_dict: dict):
# TODO:
"""SAve settings to file
"""Save settings to file
Args:
settings_dict (dict): Dictionary with the settings to be saved
Expand Down Expand Up @@ -308,6 +317,7 @@ class MonkeyHouse:
),
self.settings_w.destroy()
]

)
apply_settings_button = Button(
bottom_frame,
Expand Down

0 comments on commit 5aca4d2

Please sign in to comment.