Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.

Thu, 06 Dec 2012 19:40:03 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 06 Dec 2012 19:40:03 +0100
changeset 2246
fdf22a29fbf4
parent 2245
cbddacb4bc2e
child 2247
bddb4557c97e

Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Added code to mark the current position, if the user set his status to AWAY.

Network/IRC/IrcChannelWidget.py file | annotate | diff | comparison | revisions
Network/IRC/IrcIdentitiesEditDialog.py file | annotate | diff | comparison | revisions
Network/IRC/IrcIdentitiesEditDialog.ui file | annotate | diff | comparison | revisions
Network/IRC/IrcNetworkManager.py file | annotate | diff | comparison | revisions
Network/IRC/IrcNetworkWidget.py file | annotate | diff | comparison | revisions
Network/IRC/IrcWidget.py file | annotate | diff | comparison | revisions
--- a/Network/IRC/IrcChannelWidget.py	Wed Dec 05 19:46:44 2012 +0100
+++ b/Network/IRC/IrcChannelWidget.py	Thu Dec 06 19:40:03 2012 +0100
@@ -171,7 +171,6 @@
     #       Save
     #       Remember Position
     # TODO: Remember current position with <hr/> when widget is invisible
-    # TODO: Remember current position with <hr/> when away and configured accordingly
     # TODO: Check away indication in the user list
     def __init__(self, parent=None):
         """
--- a/Network/IRC/IrcIdentitiesEditDialog.py	Wed Dec 05 19:46:44 2012 +0100
+++ b/Network/IRC/IrcIdentitiesEditDialog.py	Thu Dec 06 19:40:03 2012 +0100
@@ -117,9 +117,6 @@
         self.rememberPosOnAwayCheckBox.setChecked(
             self.__currentIdentity.rememberAwayPosition())
         self.awayEdit.setText(self.__currentIdentity.getAwayMessage())
-        self.autoAwayGroup.setChecked(self.__currentIdentity.autoAway())
-        self.inactivitySpinBox.setValue(self.__currentIdentity.getAutoAwayTimeout())
-        self.autoReturnCheckBox.setChecked(self.__currentIdentity.autoReturn())
         
         # Advanced Tab
         self.identEdit.setText(self.__currentIdentity.getIdent())
@@ -150,9 +147,6 @@
         self.__currentIdentity.setRememberAwayPosition(
             self.rememberPosOnAwayCheckBox.isChecked())
         self.__currentIdentity.setAwayMessage(self.awayEdit.text())
-        self.__currentIdentity.setAutoAway(self.autoAwayGroup.isChecked())
-        self.__currentIdentity.setAutoAwayTimeout(self.inactivitySpinBox.value())
-        self.__currentIdentity.setAutoReturn(self.autoReturnCheckBox.isChecked())
         
         # Advanced Tab
         self.__currentIdentity.setIdent(self.identEdit.text())
--- a/Network/IRC/IrcIdentitiesEditDialog.ui	Wed Dec 05 19:46:44 2012 +0100
+++ b/Network/IRC/IrcIdentitiesEditDialog.ui	Thu Dec 06 19:40:03 2012 +0100
@@ -237,71 +237,7 @@
          </property>
         </widget>
        </item>
-       <item row="2" column="0" colspan="2">
-        <widget class="QGroupBox" name="autoAwayGroup">
-         <property name="toolTip">
-          <string>Select to send an AWAY message when inactive</string>
-         </property>
-         <property name="title">
-          <string>Auto Away</string>
-         </property>
-         <property name="checkable">
-          <bool>true</bool>
-         </property>
-         <layout class="QGridLayout" name="gridLayout_4">
-          <item row="0" column="0">
-           <widget class="QLabel" name="label_9">
-            <property name="text">
-             <string>Time of Inactivity:</string>
-            </property>
-           </widget>
-          </item>
-          <item row="0" column="1">
-           <widget class="QSpinBox" name="inactivitySpinBox">
-            <property name="toolTip">
-             <string>Enter the time of inactivity to send the automatic AWAY message</string>
-            </property>
-            <property name="alignment">
-             <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-            </property>
-            <property name="suffix">
-             <string> min</string>
-            </property>
-            <property name="minimum">
-             <number>1</number>
-            </property>
-            <property name="maximum">
-             <number>120</number>
-            </property>
-           </widget>
-          </item>
-          <item row="0" column="2">
-           <spacer name="horizontalSpacer">
-            <property name="orientation">
-             <enum>Qt::Horizontal</enum>
-            </property>
-            <property name="sizeHint" stdset="0">
-             <size>
-              <width>321</width>
-              <height>20</height>
-             </size>
-            </property>
-           </spacer>
-          </item>
-          <item row="1" column="0" colspan="3">
-           <widget class="QCheckBox" name="autoReturnCheckBox">
-            <property name="toolTip">
-             <string>Select to return automatically when activity is detected</string>
-            </property>
-            <property name="text">
-             <string>Automatically return on activity</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-       </item>
-       <item row="3" column="1">
+       <item row="2" column="1">
         <spacer name="verticalSpacer_3">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
@@ -410,9 +346,6 @@
   <tabstop>passwordEdit</tabstop>
   <tabstop>rememberPosOnAwayCheckBox</tabstop>
   <tabstop>awayEdit</tabstop>
-  <tabstop>autoAwayGroup</tabstop>
-  <tabstop>inactivitySpinBox</tabstop>
-  <tabstop>autoReturnCheckBox</tabstop>
   <tabstop>identEdit</tabstop>
   <tabstop>quitEdit</tabstop>
   <tabstop>partEdit</tabstop>
--- a/Network/IRC/IrcNetworkManager.py	Wed Dec 05 19:46:44 2012 +0100
+++ b/Network/IRC/IrcNetworkManager.py	Thu Dec 06 19:40:03 2012 +0100
@@ -45,9 +45,6 @@
         
         self.__rememberPosOnAway = True
         self.__awayMessage = IrcIdentity.DefaultAwayMessage
-        self.__autoAway = False
-        self.__autoAwayTimeout = 1
-        self.__autoReturn = False
         
         self.__quitMessage = IrcIdentity.DefaultQuitMessage
         self.__partMessage = IrcIdentity.DefaultPartMessage
@@ -68,9 +65,6 @@
         settings.setValue("PartMessage", self.__partMessage)
         settings.setValue("RememberAwayPosition", self.__rememberPosOnAway)
         settings.setValue("AwayMessage", self.__awayMessage)
-        settings.setValue("AutoAway", self.__autoAway)
-        settings.setValue("AwayTimeout", self.__autoAwayTimeout)
-        settings.setValue("AutoReturn", self.__autoReturn)
     
     def load(self, settings):
         """
@@ -88,9 +82,6 @@
         self.__rememberPosOnAway = Preferences.toBool(
             settings.value("RememberAwayPosition", True))
         self.__awayMessage = settings.value("AwayMessage", IrcIdentity.DefaultAwayMessage)
-        self.__autoAway = Preferences.toBool(settings.value("AutoAway", False))
-        self.__autoAwayTimeout = int(settings.value("AwayTimeout", 1))
-        self.__autoReturn = Preferences.toBool(settings.value("AutoReturn", False))
     
     def setName(self, name):
         """
@@ -261,54 +252,6 @@
         """
         return self.__awayMessage
     
-    def setAutoAway(self, on):
-        """
-        Public method to set the auto away function.
-        
-        @param on flag indicating to enable the auto away function (boolean)
-        """
-        self.__autoAway = on
-    
-    def autoAway(self):
-        """
-        Public method to get the auto away flag.
-        
-        @return auto away flag (boolean)
-        """
-        return self.__autoAway
-    
-    def setAutoAwayTimeout(self, minutes):
-        """
-        Public method to set the auto away timeout.
-        
-        @param minutes auto away timeout in minutes (integer)
-        """
-        self.__autoAwayTimeout = minutes
-    
-    def getAutoAwayTimeout(self):
-        """
-        Public method to get the auto away timeout.
-        
-        @return auto away timeout in minutes (integer)
-        """
-        return self.__autoAwayTimeout
-    
-    def setAutoReturn(self, on):
-        """
-        Public method to set the auto return function.
-        
-        @param on flag indicating to enable the auto return function (boolean)
-        """
-        self.__autoReturn = on
-    
-    def autoReturn(self):
-        """
-        Public method to get the auto return flag.
-        
-        @return auto return flag (boolean)
-        """
-        return self.__autoReturn
-    
     @classmethod
     def createDefaultIdentity(cls):
         """
--- a/Network/IRC/IrcNetworkWidget.py	Wed Dec 05 19:46:44 2012 +0100
+++ b/Network/IRC/IrcNetworkWidget.py	Thu Dec 06 19:40:03 2012 +0100
@@ -27,12 +27,14 @@
     @signal joinChannel(str) emitted to join a channel
     @signal nickChanged(str) emitted to change the nick name
     @signal sendData(str) emitted to send a message to the channel
+    @signal away(bool) emitted to indicate the away status
     """
     connectNetwork = pyqtSignal(str, bool)
     editNetwork = pyqtSignal(str)
     joinChannel = pyqtSignal(str)
     nickChanged = pyqtSignal(str)
     sendData = pyqtSignal(str)
+    away = pyqtSignal(bool)
     
     
     # TODO: add context menu to messages pane with these entries:
@@ -128,6 +130,7 @@
             self.sendData.emit("AWAY :" + awayMessage)
             self.awayButton.setIcon(UI.PixmapCache.getIcon("ircUserAway.png"))
             self.__away = True
+        self.away.emit(self.__away)
     
     @pyqtSlot()
     def on_editButton_clicked(self):
--- a/Network/IRC/IrcWidget.py	Wed Dec 05 19:46:44 2012 +0100
+++ b/Network/IRC/IrcWidget.py	Thu Dec 06 19:40:03 2012 +0100
@@ -39,7 +39,6 @@
     ServerConnected = 2
     ServerConnecting = 3
     
-    # TODO: Implement the Auto Away functionality
     def __init__(self, parent=None):
         """
         Constructor
@@ -66,6 +65,7 @@
         self.networkWidget.joinChannel.connect(self.__joinChannel)
         self.networkWidget.nickChanged.connect(self.__changeNick)
         self.networkWidget.sendData.connect(self.__send)
+        self.networkWidget.away.connect(self.__away)
         
         self.__channelList = []
         self.__channelTypePrefixes = ""
@@ -747,3 +747,15 @@
             return name[0] in self.__channelTypePrefixes
         else:
             return name[0] in "#&"
+    
+    def __away(self, isAway):
+        """
+        Private slot handling the change of the away state.
+        
+        @param isAway flag indicating the current away state (boolean)
+        """
+        if isAway and self.__identityName:
+            identity = self.__ircNetworkManager.getIdentity(self.__identityName)
+            if identity.rememberAwayPosition():
+                for channel in self.__channelList:
+                    channel.setMarkerLine()

eric ide

mercurial