コード例 #1
0
ファイル: quimge.py プロジェクト: Apkawa/quimge
class qUimge_setting_dialog( object):
    def __init__(self, setting, parent=None):
        '''docstring for __init__'''

        self.setting_dialog = Ui_qUimge_setting()
        self.dialog = QtGui.QDialog( parent )
        self.setting_dialog.setupUi( self.dialog )
        self.Setting = setting
        self.set_signals()

        self.style = self.Setting.get('style')
        self.default_host = self.Setting.get('default_host')
        self.start_dir = self.Setting.get("startdir", QtCore.QDir().homePath())

        self.setting_dialog.list_styles.addItems( QtGui.QStyleFactory.keys() )
        self.setting_dialog.list_styles.setCurrentIndex( self.setting_dialog.list_styles.findText( self.style) )
        self.select_default_host = self.setting_dialog.select_default_host
        make_hosts_combobox( self.select_default_host, self.default_host )

        self.setting_dialog.start_dir_edit.setText(self.start_dir)



    def set_signals(self):
        connect = self.dialog.connect
        SIGNAL = QtCore.SIGNAL
        SLOT = QtCore.SLOT
        connect( self.setting_dialog.buttonBox, SIGNAL("accepted()"), self.accept)
        connect( self.setting_dialog.select_start_dir, SIGNAL("clicked()"), self.open_folder)

    def open_folder(self):
        '''docstring for _open_folder'''
        dialog = QtGui.QFileDialog( )
        filename = dialog.getExistingDirectory(self.dialog,
                "Select folder",
                self.start_dir )
        if filename:
            start_dir = QtCore.QFileInfo( filename ).absoluteFilePath()
            self.setting_dialog.start_dir_edit.setText(start_dir)

    def exec_(self):
        self.dialog.exec_()
    def accept(self):
        cur_h  = self.select_default_host.currentIndex()
        host, obj = self.select_default_host.itemData(cur_h).toPyObject()
        self.Setting.set("default_host", host)
        self.Setting.set("style", self.setting_dialog.list_styles.currentText())
        self.Setting.set("startdir", self.setting_dialog.start_dir_edit.text())
        self.dialog.accept()
コード例 #2
0
ファイル: quimge.py プロジェクト: Apkawa/quimge
    def __init__(self, setting, parent=None):
        '''docstring for __init__'''

        self.setting_dialog = Ui_qUimge_setting()
        self.dialog = QtGui.QDialog( parent )
        self.setting_dialog.setupUi( self.dialog )
        self.Setting = setting
        self.set_signals()

        self.style = self.Setting.get('style')
        self.default_host = self.Setting.get('default_host')
        self.start_dir = self.Setting.get("startdir", QtCore.QDir().homePath())

        self.setting_dialog.list_styles.addItems( QtGui.QStyleFactory.keys() )
        self.setting_dialog.list_styles.setCurrentIndex( self.setting_dialog.list_styles.findText( self.style) )
        self.select_default_host = self.setting_dialog.select_default_host
        make_hosts_combobox( self.select_default_host, self.default_host )

        self.setting_dialog.start_dir_edit.setText(self.start_dir)