mirror of
https://github.com/vale981/rmview
synced 2025-03-05 09:11:39 -05:00
Better error handling
This commit is contained in:
parent
5045b4a647
commit
8e19e8279c
1 changed files with 18 additions and 5 deletions
|
@ -85,11 +85,17 @@ class FrameBufferWorker(QRunnable):
|
||||||
self.signals = FBWSignals()
|
self.signals = FBWSignals()
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
self._stop = True
|
||||||
log.info("Stopping framebuffer thread...")
|
log.info("Stopping framebuffer thread...")
|
||||||
reactor.callFromThread(reactor.stop)
|
reactor.callFromThread(reactor.stop)
|
||||||
self.ssh.exec_command("killall rM-vnc-server")
|
try:
|
||||||
|
self.ssh.exec_command("killall rM-vnc-server", timeout=3)
|
||||||
|
except Exception as e:
|
||||||
|
log.warning("VNC could not be stopped on the reMarkable.")
|
||||||
|
log.warning("Although this is not a big problem, it may consume some resources until you restart the tablet.")
|
||||||
|
log.warning("You can manually terminate it by running `ssh %s killall rM-vnc-server`.", self.ssh.hostname)
|
||||||
|
log.error(e)
|
||||||
log.info("Framebuffer thread stopped")
|
log.info("Framebuffer thread stopped")
|
||||||
self._stop = True
|
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def run(self):
|
def run(self):
|
||||||
|
@ -98,12 +104,19 @@ class FrameBufferWorker(QRunnable):
|
||||||
log.debug("Insmod returned %d", out.channel.recv_exit_status())
|
log.debug("Insmod returned %d", out.channel.recv_exit_status())
|
||||||
_,_,out = self.ssh.exec_command("$HOME/rM-vnc-server")
|
_,_,out = self.ssh.exec_command("$HOME/rM-vnc-server")
|
||||||
log.info(next(out))
|
log.info(next(out))
|
||||||
self.vncClient = internet.TCPClient(self.ssh.hostname, 5900, RFBFactory(self.signals))
|
|
||||||
self.vncClient.startService()
|
|
||||||
reactor.run(installSignalHandlers=0)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.signals.onFatalError.emit(e)
|
self.signals.onFatalError.emit(e)
|
||||||
|
|
||||||
|
while self._stop == False:
|
||||||
|
log.info("Starting VNC server")
|
||||||
|
try:
|
||||||
|
self.vncClient = internet.TCPClient(self.ssh.hostname, 5900, RFBFactory(self.signals))
|
||||||
|
self.vncClient.startService()
|
||||||
|
reactor.run(installSignalHandlers=0)
|
||||||
|
except Exception as e:
|
||||||
|
log.error(e)
|
||||||
|
|
||||||
|
|
||||||
class PWSignals(QObject):
|
class PWSignals(QObject):
|
||||||
onFatalError = pyqtSignal(Exception)
|
onFatalError = pyqtSignal(Exception)
|
||||||
onPenMove = pyqtSignal(int, int)
|
onPenMove = pyqtSignal(int, int)
|
||||||
|
|
Loading…
Add table
Reference in a new issue