Wake the screen at print start and end (#229)

* Wake the screen at print start and end

* job_status: Wake screen on re-print

Co-authored-by: Jordan <jordan.ruthe@gmail.com>
This commit is contained in:
Alfredo Monclus 2021-08-19 22:07:24 -03:00 committed by GitHub
parent 8bfaf69109
commit 41e917bc41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -201,6 +201,7 @@ class JobStatusPanel(ScreenPanel):
self.content.add(grid)
self._screen.add_subscription(panel_name)
self._screen.wake_screen()
def on_draw(self, da, ctx):
w = da.get_allocated_width()
@ -358,6 +359,7 @@ class JobStatusPanel(ScreenPanel):
self.close_timeouts.remove(to)
if self.timeout == None:
GLib.timeout_add(500, self.state_check)
self._screen.wake_screen()
self.state_check()
def process_update(self, action, data):
@ -461,6 +463,7 @@ class JobStatusPanel(ScreenPanel):
self.progress = 1
self.update_progress()
self.set_state("complete")
self._screen.wake_screen()
timeout = self._config.get_main_config().getint("job_complete_timeout", 30)
if timeout != 0:
self.close_timeouts.append(GLib.timeout_add(timeout * 1000, self.close_panel))
@ -469,6 +472,7 @@ class JobStatusPanel(ScreenPanel):
logging.debug("Error!")
self.set_state("error")
self.labels['status'].set_text("%s - %s" % (_("Error"), ps['message']))
self._screen.wake_screen()
timeout = self._config.get_main_config().getint("job_error_timeout", 0)
if timeout != 0:
self.close_timeouts.append(GLib.timeout_add(timeout * 1000, self.close_panel))
@ -476,6 +480,7 @@ class JobStatusPanel(ScreenPanel):
elif ps['state'] == "standby":
# Print was cancelled
self.set_state("cancelled")
self._screen.wake_screen()
timeout = self._config.get_main_config().getint("job_cancelled_timeout", 0)
if timeout != 0:
self.close_timeouts.append(GLib.timeout_add(timeout * 1000, self.close_panel))

View File

@ -528,6 +528,10 @@ class KlipperScreen(Gtk.Window):
self._menu_go_back()
return True
def wake_screen(self):
# Wake the screen (it will go to standby as configured)
os.system("xset -display :0 dpms force on")
def set_screenblanking_timeout(self, time):
# Disable screen blanking
os.system("xset -display :0 s off")