Пример #1
0
class OptionsWidget(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self,parent)
        self.ui = Options_Form()
        self.ui.setupUi(self)
        self.initUi()
        self.initSignals()
        self.show()

    def initUi(self):
        self.general = GeneralSettings()
        self.network = NetworkSettings()

        self.tab = self.general

        self.tab.setParent(self.ui.widget_2)

        self.ui.pushButton_2.setIcon(QIcon(Config.data['GENERAL_SETTINGS']))
        self.ui.pushButton_3.setIcon(QIcon(Config.data['NETWORK_SETTINGS']))
        QObject.connect(self.ui.pushButton_2, SIGNAL('clicked()'), self.generalsettings)
        QObject.connect(self.ui.pushButton_3, SIGNAL('clicked()'), self.networksettings)

        self.setWindowTitle('Options')
    def generalsettings(self):
        self.tab.setParent(None)
        self.tab = self.general
        self.tab.setParent(self.ui.widget_2)
        self.tab.show()

    def networksettings(self):
        self.tab.setParent(None)
        self.tab = self.network
        self.tab.setParent(self.ui.widget_2)
        self.tab.show()

    def save(self):
        threads = self.general.ui.horizontalSlider.sliderPosition()
        chunksize = self.general.ui.lineEdit.text()
        downspeed = self.network.ui.lineEdit_2.text()
        upspeed = self.network.ui.lineEdit_3.text()

        #Saving each property to file :)
        Config.changeProperty('THREADS', threads)
        Config.changeProperty('CHUNK_SIZE', chunksize)
        Config.changeProperty('DOWNLOAD_MAX',downspeed)
        Config.changeProperty('UPLOAD_MAX', upspeed)

        Config.saveContacts(self.general.ui.plainTextEdit.toPlainText())
        self.hide()
    def initSignals(self):
        QObject.connect(self.ui.pushButton, SIGNAL('clicked()'), self.save)
Пример #2
0
 def __init__(self, parent=None):
     QWidget.__init__(self,parent)
     self.ui = Options_Form()
     self.ui.setupUi(self)
     self.initUi()
     self.initSignals()
     self.show()