Beispiel #1
0
    def __init__(self, parent, standAlone=True, app=None):
        QtGui.QWidget.__init__(self, parent)

        # Create the ui
        self.ui = Ui_mainManager()
        self.app = app
        self.lastEditedPackage = None
        self.lastEditedData = None
        self.lastEditedInfo = None
        self.isEditBox = None

        # Network Manager can run as KControl Module or Standalone
        if standAlone:
            self.ui.setupUi(self)
            self.baseWidget = self
        else:
            self.ui.setupUi(parent)
            self.baseWidget = parent

        # Workaround for Pyuic Problem
        self.ui.buttonCancelMini.setText('')

        # Set visibility of indicators
        self.ui.workingLabel.hide()
        self.ui.refreshButton.hide()

        # Call Comar
        self.iface = NetworkIface()
        self.widgets = {}

        # Populate Packages
        self.packages = {}
        for package in self.iface.packages():
            self.packages[package] = self.iface.linkInfo(package)

        # Naruto
        self.animator = QTimeLine(ANIMATION_TIME, self)

        # List of functions to call after animation is finished
        self.animatorFinishHook = []

        # Let look what we can do
        self.refreshBrowser()

        # Security dialog
        self.securityDialog = SecurityDialog(parent)
        self.securityFields = []
        self.securityValues = {}

        # Nameserver dialog
        self.nameserverDialog = NameServerDialog(parent)

        # Preparing for animation
        self.ui.editBox.setMaximumHeight(TARGET_HEIGHT)
        self.lastAnimation = SHOW

        # Animator connections, Naruto loves Sakura-chan
        self.connect(self.animator, SIGNAL("frameChanged(int)"), self.animate)
        self.connect(self.animator, SIGNAL("finished()"), self.animateFinished)

        # Hide editBox when clicked mini cancel
        self.connect(self.ui.buttonCancelMini, SIGNAL("clicked()"),
                     self.hideEditBox)

        # Save changes when clicked Apply, Reject changes when clicked Cancel
        self.connect(self.ui.buttonBox, SIGNAL("rejected()"), self.hideEditBox)
        self.connect(self.ui.buttonBox, SIGNAL("accepted()"),
                     self.applyChanges)

        # Show NameServer Settings Dialog
        self.ui.buttonNameServer.setIcon(KIcon("configure"))
        self.connect(self.ui.buttonNameServer, SIGNAL("clicked()"),
                     self.slotNameServerDialog)

        # Filter
        self.connect(self.ui.filterBox, SIGNAL("currentIndexChanged(int)"),
                     self.filterList)

        # Refresh button for scanning remote again..
        self.connect(self.ui.refreshButton, SIGNAL("leftClickedUrl()"),
                     self.filterESSID)

        # Security details button
        self.connect(self.ui.pushSecurity, SIGNAL("clicked()"),
                     self.openSecurityDialog)

        # Security types
        self.connect(self.ui.comboSecurityTypes,
                     SIGNAL("currentIndexChanged(int)"),
                     self.slotSecurityChanged)

        # Update service status and follow Comar for sate changes
        self.getConnectionStates()