/usr/share/arm/gui/connections/connPanel.py is in tor-arm 1.4.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | """
Connections panel.
"""
import random
import sys
import time
from collections import deque
import gobject
import gtk
from cli.connections import (circEntry as cliCircEntry, connEntry as cliConnEntry, entries)
from cli.connections.connPanel import ConnectionPanel as CliConnectionPanel
from gui.connections import circEntry, connEntry
from util import connections, gtkTools, sysTools, uiTools, torTools
from TorCtl import TorCtl
def convert_to_gui(cliInstance):
cliToGuiMap = [ (cliCircEntry.CircHeaderLine, circEntry.CircHeaderLine),
(cliCircEntry.CircLine, circEntry.CircLine),
(cliConnEntry.ConnectionLine, connEntry.ConnectionLine)]
line = None
for (cliClass, guiClass) in cliToGuiMap:
if isinstance(cliInstance, cliClass):
line = guiClass(cliInstance)
break
return line
class EntryLines(gtkTools.TreeWrapper):
def __init__(self, container, model=None, listingType=None):
gtkTools.TreeWrapper.__init__(self, container, model)
self._listingType = listingType if listingType else entries.ListingType.IP_ADDRESS
def _model_append(self, cliLine):
if not self.model:
return
row = self._create_row_from_value(cliLine)
line = convert_to_gui(cliLine)
if isinstance(line, circEntry.CircHeaderLine):
self.headerIter = self.model.append(None, row)
elif isinstance(line, circEntry.CircLine):
self.model.append(self.headerIter, row)
else:
self.model.append(None, row)
def _create_row_from_value(self, cliLine):
line = convert_to_gui(cliLine)
row = line.get_listing_row(self._listingType)
return row
class ConnectionPanel(CliConnectionPanel):
def __init__(self, builder):
CliConnectionPanel.__init__(self, None)
self.builder = builder
conn = torTools.getConn()
torPid = conn.getMyPid()
torCmdName = sysTools.getProcessName(torPid, 'tor')
connections.getResolver(torCmdName, torPid, 'tor')
treeStore = self.builder.get_object('treestore_conn')
self._wrappedEntryLines = EntryLines(self._entryLines, treeStore)
@property
def _entryLines(self):
if hasattr(self, '_wrappedEntryLines'):
return self._wrappedEntryLines.container
else:
return []
@_entryLines.setter
def _entryLines(self, value):
if hasattr(self, '_wrappedEntryLines'):
self._wrappedEntryLines.empty()
for entry in value:
self._wrappedEntryLines.append(entry)
else:
self._wrappedEntryLines = EntryLines(value)
def pack_widgets(self):
self.start()
|