changeset 25:2e5a12e3598e

add a low color mode
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 26 Sep 2014 04:57:10 +0200
parents 9d7245e45379
children 1601d498cfb1
files RemoteViewer/Connection.py RemoteViewer/ConnectionDialog.py RemoteViewer/ConnectionDialog.ui RemoteViewer/Viewer.py
diffstat 4 files changed, 32 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/RemoteViewer/Connection.py	Fri Sep 26 04:33:38 2014 +0200
+++ b/RemoteViewer/Connection.py	Fri Sep 26 04:57:10 2014 +0200
@@ -1,7 +1,7 @@
 from uuid import uuid4
 from .Viewer import VncViewer, FreeRdp
 
-KEYS = ['geometry', 'id', 'host', 'title', 'type', 'user']
+KEYS = ['geometry', 'id', 'host', 'lowColor', 'title', 'type', 'user']
 
 def filter_string(func):
     """decorator function to filter turn empty strings into None"""
@@ -28,6 +28,7 @@
         self.title = None
         self.type = 'vnc'
         self.user = None
+        self.lowColor = False
 
     def __str__(self):
         return 'connection@{} "{}" of type {} to {} with user {} and geometry {}'.format(self.title, id(self), self.type,  self.host, self.user, self.geometry)
@@ -56,6 +57,10 @@
         """This is a slot that is connected to a signal in the GUI"""
         self.geometry = geometry
 
+    def setLowColor(self, lowColor):
+        """This is a slot that is connected to a signal in the GUI"""
+        self.lowColor = lowColor
+
     def displayString(self):
         if self.title is not None:
             return self.title
--- a/RemoteViewer/ConnectionDialog.py	Fri Sep 26 04:33:38 2014 +0200
+++ b/RemoteViewer/ConnectionDialog.py	Fri Sep 26 04:57:10 2014 +0200
@@ -1,3 +1,4 @@
+from PyQt4.QtCore import Qt
 from PyQt4.QtGui import QDialog
 from .Connection import Connection
 from .Ui_ConnectionDialog import Ui_ConnectionDialog
@@ -30,6 +31,10 @@
         self.ui.hostname.setText(self.connection.host)
         self.ui.username.setText(self.connection.user)
         self.ui.geometry.setText(self.connection.geometry)
+        checkState = Qt.Unchecked
+        if self.connection.lowColor is True:
+            checkState = Qt.Checked
+        self.ui.lowColor.setCheckState(checkState)
 
     def __connectWidgetSlots(self):
         self.ui.title.textChanged.connect(self.connection.setTitle)
@@ -37,6 +42,7 @@
         self.ui.hostname.textChanged.connect(self.connection.setHost)
         self.ui.username.textChanged.connect(self.connection.setUser)
         self.ui.geometry.textChanged.connect(self.connection.setGeometry)
+        self.ui.lowColor.clicked[bool].connect(self.connection.setLowColor)
 
     def accept(self):
         validationErrors = self.connection.validate()
--- a/RemoteViewer/ConnectionDialog.ui	Fri Sep 26 04:33:38 2014 +0200
+++ b/RemoteViewer/ConnectionDialog.ui	Fri Sep 26 04:57:10 2014 +0200
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>400</width>
-    <height>212</height>
+    <height>233</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -93,6 +93,20 @@
    <item row="0" column="1">
     <widget class="QLineEdit" name="title"/>
    </item>
+   <item row="5" column="1">
+    <widget class="QCheckBox" name="lowColor">
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="0">
+    <widget class="QLabel" name="label_6">
+     <property name="text">
+      <string>Low Color:</string>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <tabstops>
--- a/RemoteViewer/Viewer.py	Fri Sep 26 04:33:38 2014 +0200
+++ b/RemoteViewer/Viewer.py	Fri Sep 26 04:57:10 2014 +0200
@@ -45,6 +45,9 @@
         self.command = ['vncviewer']
         self.append('-geometry', self.connection.geometry)
         self.append('-DesktopSize', self.connection.geometry)
+        if self.connection.lowColor:
+            self.command.append('-AutoSelect=0')
+            self.append('-LowColourLevel', '1')
         self.command.append(self.connection.host)
 
     def append(self, option, value):
@@ -59,6 +62,8 @@
         self.append('/t:', self.connection.displayString())
         self.append('/u:', self.connection.user)
         self.append('/size:', self.connection.geometry)
+        if self.connection.lowColor:
+            self.command.append('/bpp:8')
 
     def append(self, option, value):
         if value is not None: