def __init__(self, rootWidget): QWidget.__init__(self, ctx.mainScreen) self.ui = Ui_connectionWidget() self.ui.setupUi(self) self.setStyleSheet(""" QFrame#mainFrame { background-image: url(:/gui/pics/transBlack.png); border: 1px solid #BBB; border-radius:8px; } QWidget#autoPartQuestion { background-image: url(:/gui/pics/trans.png); } """) self.rootWidget = rootWidget self.needsExecute = False self.ui.buttonCancel.clicked.connect(self.hide) self.ui.buttonConnect.clicked.connect(self.slotUseSelected) self.connections = getConnectionList() if self.connections: for package in self.connections.keys(): for connection in self.connections[package]: ci = ConnectionItem(self.ui.connectionList, unicode(str(connection)), package) self.ui.connectionList.setCurrentRow(0) self.resize(ctx.mainScreen.size())
class ConnectionWidget(QWidget): def __init__(self, rootWidget): QWidget.__init__(self, ctx.mainScreen) self.ui = Ui_connectionWidget() self.ui.setupUi(self) self.setStyleSheet(""" QFrame#mainFrame { background-image: url(:/gui/pics/transBlack.png); border: 1px solid #BBB; border-radius:8px; } QWidget#autoPartQuestion { background-image: url(:/gui/pics/trans.png); } """) self.rootWidget = rootWidget self.needsExecute = False self.connect(self.ui.buttonCancel, SIGNAL("clicked()"), self.hide) self.connect(self.ui.buttonConnect, SIGNAL("clicked()"), self.slotUseSelected) self.connections = getConnectionList() if self.connections: for package in self.connections.keys(): for connection in self.connections[package]: ci = ConnectionItem(self.ui.connectionList, unicode(str(connection)), package) self.ui.connectionList.setCurrentRow(0) self.resize(ctx.mainScreen.size()) def slotUseSelected(self): current = self.ui.connectionList.currentItem() if current: ctx.interface.informationWindow.update( _("Connecting to network %s...") % current.getConnection()) try: ret = current.connect() except: ret = True self.rootWidget.ui.labelStatus.setText(_("Connection failed")) ctx.interface.informationWindow.update(_("Connection failed")) if not ret: self.rootWidget.ui.labelStatus.setText(_("Connected")) ctx.interface.informationWindow.update(_("Connected")) self.hide() ctx.mainScreen.processEvents() ctx.interface.informationWindow.hide() if self.needsExecute: self.rootWidget.execute_(True)
class ConnectionWidget(QtGui.QWidget): def __init__(self, rootWidget): QtGui.QWidget.__init__(self, ctx.mainScreen) self.ui = Ui_connectionWidget() self.ui.setupUi(self) self.setStyleSheet(""" QFrame#mainFrame { background-image: url(:/gui/pics/transBlack.png); border: 1px solid #BBB; border-radius:8px; } QWidget#autoPartQuestion { background-image: url(:/gui/pics/trans.png); } """) self.rootWidget = rootWidget self.needsExecute = False self.connect(self.ui.buttonCancel, SIGNAL("clicked()"), self.hide) self.connect(self.ui.buttonConnect, SIGNAL("clicked()"), self.slotUseSelected) self.connections = getConnectionList() if self.connections: for package in self.connections.keys(): for connection in self.connections[package]: ci = ConnectionItem(self.ui.connectionList, unicode(str(connection)), package) self.ui.connectionList.setCurrentRow(0) self.resize(ctx.mainScreen.size()) def slotUseSelected(self): current = self.ui.connectionList.currentItem() if current: ctx.yali.info.updateAndShow(_("Connecting to network %s...") % current.getConnection()) try: ret = current.connect() except: ret = True self.rootWidget.ui.labelStatus.setText(_("Connection failed")) ctx.yali.info.updateAndShow(_("Connection failed")) if not ret: self.rootWidget.ui.labelStatus.setText(_("Connected")) ctx.yali.info.updateAndShow(_("Connected")) self.hide() ctx.mainScreen.processEvents() ctx.yali.info.hide() if self.needsExecute: self.rootWidget.execute_(True)
def __init__(self, rootWidget): QtGui.QWidget.__init__(self, ctx.mainScreen) self.ui = Ui_connectionWidget() self.ui.setupUi(self) self.setStyleSheet(""" QFrame#mainFrame { background-image: url(:/gui/pics/transBlack.png); border: 1px solid #BBB; border-radius:8px; } QWidget#autoPartQuestion { background-image: url(:/gui/pics/trans.png); } """) self.rootWidget = rootWidget self.needsExecute = False self.connect(self.ui.buttonCancel, SIGNAL("clicked()"), self.hide) self.connect(self.ui.buttonConnect, SIGNAL("clicked()"), self.slotUseSelected) self.connections = getConnectionList() if self.connections: for package in self.connections.keys(): for connection in self.connections[package]: ci = ConnectionItem(self.ui.connectionList, unicode(str(connection)), package) self.ui.connectionList.setCurrentRow(0) self.resize(ctx.mainScreen.size())