Made the IRC marker line colors configurable and added a config option to not set a marker when the chat window is hidden.

Mon, 10 Dec 2012 18:36:29 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 10 Dec 2012 18:36:29 +0100
changeset 2257
4c3bda2b71f2
parent 2256
d07e2e6f3c56
child 2258
9ca42fd3ecc0

Made the IRC marker line colors configurable and added a config option to not set a marker when the chat window is hidden.

Network/IRC/IrcChannelWidget.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/IrcPage.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/IrcPage.ui file | annotate | diff | comparison | revisions
Preferences/__init__.py file | annotate | diff | comparison | revisions
--- a/Network/IRC/IrcChannelWidget.py	Sun Dec 09 19:43:32 2012 +0100
+++ b/Network/IRC/IrcChannelWidget.py	Mon Dec 10 18:36:29 2012 +0100
@@ -971,7 +971,9 @@
         """
         Private slot to append a message.
         """
-        if self.__hidden and self.__markerLine == "":
+        if self.__hidden and \
+           self.__markerLine == "" and \
+           Preferences.getIrc("MarkPositionWhenHidden"):
             self.setMarkerLine()
         self.messages.append(message)
     
@@ -980,9 +982,10 @@
         Public method to draw a line to mark the current position.
         """
         self.unsetMarkerLine()
-        # TODO: make colors configurable
         self.__markerLine = \
-            '<span style=" color:#000000; background-color:#ffff00;">{0}</span>'.format(
+            '<span style=" color:{0}; background-color:{1};">{2}</span>'.format(
+            Preferences.getIrc("MarkerLineForegroundColour"),
+            Preferences.getIrc("MarkerLineBackgroundColour"),
             self.trUtf8('--- New From Here ---'))
         self.messages.append(self.__markerLine)
     
--- a/Preferences/ConfigurationPages/IrcPage.py	Sun Dec 09 19:43:32 2012 +0100
+++ b/Preferences/ConfigurationPages/IrcPage.py	Mon Dec 10 18:36:29 2012 +0100
@@ -109,6 +109,14 @@
         self.whoGroup.setChecked(Preferences.getIrc("AutoUserInfoLookup"))
         self.whoUsersSpinBox.setValue(Preferences.getIrc("AutoUserInfoMax"))
         self.whoIntervalSpinBox.setValue(Preferences.getIrc("AutoUserInfoInterval"))
+        
+        # Markers
+        self.markWhenHiddenCheckBox.setChecked(
+            Preferences.getIrc("MarkPositionWhenHidden"))
+        self.initColour("MarkerLineForegroundColour", self.markerForegroundButton,
+                         Preferences.getIrc, byName=True)
+        self.initColour("MarkerLineBackgroundColour", self.markerBackgroundButton,
+                         Preferences.getIrc, byName=True)
     
     def save(self):
         """
@@ -131,6 +139,10 @@
         Preferences.setIrc("AutoUserInfoMax", self.whoUsersSpinBox.value())
         Preferences.setIrc("AutoUserInfoInterval", self.whoIntervalSpinBox.value())
         
+        # Markers
+        Preferences.setIrc("MarkPositionWhenHidden",
+            self.markWhenHiddenCheckBox.isChecked())
+        
         # colours
         self.saveColours(Preferences.setIrc)
 
--- a/Preferences/ConfigurationPages/IrcPage.ui	Sun Dec 09 19:43:32 2012 +0100
+++ b/Preferences/ConfigurationPages/IrcPage.ui	Mon Dec 10 18:36:29 2012 +0100
@@ -10,7 +10,7 @@
     <height>853</height>
    </rect>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
+  <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
     <widget class="QLabel" name="headerLabel">
      <property name="text">
@@ -788,6 +788,75 @@
     </widget>
    </item>
    <item>
+    <widget class="QGroupBox" name="markerGroup">
+     <property name="title">
+      <string>Marker</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QCheckBox" name="markWhenHiddenCheckBox">
+        <property name="toolTip">
+         <string>Select to mark the current position, when the chat window is hidden</string>
+        </property>
+        <property name="text">
+         <string>Mark Current Position When Hidden</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QLabel" name="label_33">
+          <property name="text">
+           <string>Marker Foreground:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="markerForegroundButton">
+          <property name="minimumSize">
+           <size>
+            <width>100</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="toolTip">
+           <string>Select the foreground colour for the marker</string>
+          </property>
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="label_34">
+          <property name="text">
+           <string>Marker Background:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="markerBackgroundButton">
+          <property name="minimumSize">
+           <size>
+            <width>100</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="toolTip">
+           <string>Select the background colour for the marker</string>
+          </property>
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
--- a/Preferences/__init__.py	Sun Dec 09 19:43:32 2012 +0100
+++ b/Preferences/__init__.py	Mon Dec 10 18:36:29 2012 +0100
@@ -957,6 +957,10 @@
         "AutoUserInfoLookup": True,
         "AutoUserInfoMax": 200,
         "AutoUserInfoInterval": 90,
+        
+        "MarkPositionWhenHidden": True,
+        "MarkerLineForegroundColour": "#000000",    # Black on
+        "MarkerLineBackgroundColour": "#ffff00",    # Yellow
     }
 
 
@@ -2592,7 +2596,7 @@
     """
     if key in ["TimestampIncludeDate", "ShowTimestamps", "ShowNotifications",
                "NotifyJoinPart", "NotifyMessage", "NotifyNick", "EnableIrcColours",
-               "AutoUserInfoLookup"]:
+               "AutoUserInfoLookup", "MarkPositionWhenHidden"]:
         return toBool(prefClass.settings.value("IRC/" + key,
                 prefClass.ircDefaults[key]))
     elif key in ["AutoUserInfoMax", "AutoUserInfoInterval"]:

eric ide

mercurial