Skip to content

Commit

Permalink
Actually fix release notes working by defaulting to full version numb…
Browse files Browse the repository at this point in the history
…er checks, bump to 0.4.8.20
  • Loading branch information
C0rn3j committed Aug 27, 2024
1 parent b22e709 commit 8e22fbe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion scc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
If SC-Controller is updated while daemon is running, DAEMON_VERSION send by
daemon will differ one one expected by UI and daemon will be forcefully restarted.
"""
DAEMON_VERSION = "0.4.8.19"
DAEMON_VERSION = "0.4.8.20"

HPERIOD = 0.02
LPERIOD = 0.5
Expand Down
24 changes: 13 additions & 11 deletions scc/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1487,9 +1487,9 @@ def aso(long_name, short_name, description,

self.connect('handle-local-options', self.do_local_options)

aso("verbose", b"v", "Be verbose")
aso("debug", b"d", "Be more verbose (debug mode)")
aso("osd", b"o", "OSD mode (OSD-controllable editor for current profile)")
aso("verbose", b"v", "Be verbose")
aso("debug", b"d", "Be more verbose (debug mode)")
aso("osd", b"o", "OSD mode (OSD-controllable editor for current profile)")


def save_profile_selection(self, path):
Expand All @@ -1508,24 +1508,26 @@ def load_profile_selection(self):
""" Returns name profile from config file or None if there is none saved """
try:
return self.config['recent_profiles'][0]
except:
except Exception:
return None


@staticmethod
def get_release(n=3):
def get_release(n:int = 4) -> str:
"""
Returns current version rounded to max. 'n' numbers.
( v0.14.1.3 ; n=3 -> v0.14.1 )
"""
split = DAEMON_VERSION.split(".")[0:n]
while split[-1] == "0": split = split[0:len(split) - 1]
while split[-1] == "0":
split = split[0:len(split) - 1]
return ".".join(split)


def release_notes_visible(self):
def release_notes_visible(self) -> bool:
""" Returns True if release notes infobox is visible """
if not self.ribar: return False
if not self.ribar:
return False
riNewRelease = self.builder.get_object('riNewRelease')
return self.ribar._infobar == riNewRelease

Expand All @@ -1536,7 +1538,7 @@ def check_release_notes(self):
informing user that they are ready to be displayed.
"""
url = App.RELEASE_URL % (App.get_release(),)
log.debug("Loading release notes from '%s'", url)
log.debug(f"Loading release notes from '{url}'")
f = Gio.File.new_for_uri(url)
buffer = b""

Expand All @@ -1549,7 +1551,7 @@ def stream_ready(stream, task, buffer):
else:
self.on_got_release_notes(buffer.decode("utf-8"))
except Exception as e:
log.warning("Failed to read release notes")
log.warning(f"Failed to read release notes at {url}, maybe your internet connection is down?")
log.exception(e)
return

Expand All @@ -1559,7 +1561,7 @@ def http_ready(f, task, buffer):
assert stream
stream.read_bytes_async(102400, 0, None, stream_ready, buffer)
except Exception as e:
log.warning("Failed to read release notes, maybe your internet connection is down?")
log.warning(f"Failed to read release notes at {url}, maybe your internet connection is down?")
# log.exception(f"Following Traceback error is not fatal and can be ignored: {e}")
return

Expand Down

0 comments on commit 8e22fbe

Please sign in to comment.