/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-monitor

  • Committer: teddy at bsnet
  • Date: 2010-09-02 19:07:20 UTC
  • mto: (24.1.154 mandos)
  • mto: This revision was merged to the branch mainline in revision 421.
  • Revision ID: teddy@fukt.bsnet.se-20100902190720-sp0pitu30isx4pvi
* mandos (ClientDBus.approvals_pending): Bug fix: Only send D-Bus
                                         signals if connected to the
                                         D-Bus.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        self.properties.update(
58
58
            self.proxy.GetAll(client_interface,
59
59
                              dbus_interface = dbus.PROPERTIES_IFACE))
60
 
 
61
 
        #XXX This break good super behaviour!
62
 
#        super(MandosClientPropertyCache, self).__init__(
63
 
#            *args, **kwargs)
 
60
        super(MandosClientPropertyCache, self).__init__(
 
61
            proxy_object=proxy_object, *args, **kwargs)
64
62
    
65
63
    def property_changed(self, property=None, value=None):
66
64
        """This is called whenever we get a PropertyChanged signal
186
184
                          u"bold-underline-blink":
187
185
                              u"bold-underline-blink-standout",
188
186
                          }
189
 
 
 
187
        
190
188
        # Rebuild focus and non-focus widgets using current properties
191
 
 
192
 
        # Base part of a client. Name!
193
 
        self._text = (u'%(name)s: '
194
 
                      % {u"name": self.properties[u"name"]})
195
 
 
196
 
        if self.properties[u"approved_pending"]:
197
 
            if self.properties[u"approved_by_default"]:
198
 
                self._text += u"Connection established to client. (d)eny?"
199
 
            else:
200
 
                self._text += u"Seeks approval to send secret. (a)pprove?"
201
 
        else:
202
 
            self._text += (u'%(enabled)s'
203
 
                           % {u"enabled":
204
 
                               (u"enabled"
205
 
                                if self.properties[u"enabled"]
206
 
                                else u"DISABLED")})
 
189
        self._text = (u'%(name)s: %(enabled)s'
 
190
                      % { u"name": self.properties[u"name"],
 
191
                          u"enabled":
 
192
                              (u"enabled"
 
193
                               if self.properties[u"enabled"]
 
194
                               else u"DISABLED")})
207
195
        if not urwid.supports_unicode():
208
196
            self._text = self._text.encode("ascii", "replace")
209
197
        textlist = [(u"normal", self._text)]
233
221
    def keypress(self, (maxcol,), key):
234
222
        """Handle keys.
235
223
        This overrides the method from urwid.FlowWidget"""
236
 
        if key == u"+":
237
 
            self.proxy.Enable(dbus_interface = client_interface)
238
 
        elif key == u"-":
239
 
            self.proxy.Disable(dbus_interface = client_interface)
240
 
        elif key == u"a":
241
 
            self.proxy.Approve(dbus.Boolean(True, variant_level=1),
242
 
                               dbus_interface = client_interface)
243
 
        elif key == u"d":
244
 
            self.proxy.Approve(dbus.Boolean(False, variant_level=1),
245
 
                                  dbus_interface = client_interface)
 
224
        if key == u"e" or key == u"+":
 
225
            self.proxy.Enable()
 
226
        elif key == u"d" or key == u"-":
 
227
            self.proxy.Disable()
246
228
        elif key == u"r" or key == u"_" or key == u"ctrl k":
247
229
            self.server_proxy_object.RemoveClient(self.proxy
248
230
                                                  .object_path)
249
231
        elif key == u"s":
250
 
            self.proxy.StartChecker(dbus_interface = client_interface)
 
232
            self.proxy.StartChecker()
251
233
        elif key == u"S":
252
 
            self.proxy.StopChecker(dbus_interface = client_interface)
 
234
            self.proxy.StopChecker()
253
235
        elif key == u"C":
254
 
            self.proxy.CheckedOK(dbus_interface = client_interface)
 
236
            self.proxy.CheckedOK()
255
237
        # xxx
256
238
#         elif key == u"p" or key == "=":
257
239
#             self.proxy.pause()
259
241
#             self.proxy.unpause()
260
242
#         elif key == u"RET":
261
243
#             self.open()
262
 
#        elif key == u"+":
263
 
#            self.proxy.Approve(True)
264
 
#        elif key == u"-":
265
 
#            self.proxy.Approve(False)
 
244
        elif key == u"+":
 
245
            self.proxy.Approve(True)
 
246
        elif key == u"-":
 
247
            self.proxy.Approve(False)
266
248
        else:
267
249
            return key
268
250
    
565
547
                                             u"r: Remove",
566
548
                                             u"s: Start new checker",
567
549
                                             u"S: Stop checker",
568
 
                                             u"C: Checker OK",
569
 
                                             u"A: Approve",
570
 
                                             u"D: Deny"))))
 
550
                                             u"C: Checker OK"))))
571
551
                self.refresh()
572
552
            elif key == u"tab":
573
553
                if self.topwidget.get_focus() is self.logbox: