def __init__(self, parent=None): QDialog.__init__(self, parent) self.setMaximumSize(QSize(0, 0)) self.setMinimumSize(450, 0) self.setWindowTitle('Create a new backup') #input_backup_name self.input_backup_name = QLineEdit(self) self.input_backup_name.setToolTip('Name of backup') self.input_backup_name.setFocus() #btn_change_save_backup self.btn_change_save_backup = QPushButton( load_config('save_backup_folder'), self) self.btn_change_save_backup.sizeHint() self.btn_change_save_backup.setAutoDefault(False) #btn_cancel self.btn_cancel = QPushButton('Cancel', self) self.btn_cancel.setAutoDefault(False) #btn_create_backup self.btn_create_backup = QPushButton('Create backup', self) #LAYOUTS #Backup name layout self.layout_name = QHBoxLayout() self.layout_name.addWidget(QLabel('Name:', self)) self.layout_name.addWidget(self.input_backup_name) #Save Backup Folder Layout self.layout_save_folder = QHBoxLayout() self.layout_save_folder.addWidget(QLabel('Save folder:', self)) self.layout_save_folder.addWidget(self.btn_change_save_backup, Qt.AlignCenter) #Standard Buttons Layout self.layout_standard_buttons = QHBoxLayout() self.layout_standard_buttons.setContentsMargins(90, 20, 0, 0) self.layout_standard_buttons.addWidget(self.btn_cancel) self.layout_standard_buttons.addWidget(self.btn_create_backup) #Vertical Container Layout self.Vcontainer = QVBoxLayout(self) self.Vcontainer.addLayout(self.layout_name) self.Vcontainer.addLayout(self.layout_save_folder) self.Vcontainer.addLayout(self.layout_standard_buttons) #CONNECT SIGNALS self.connect(self.btn_change_save_backup, SIGNAL('clicked()'), self.change_save_backup) self.connect(self.btn_cancel, SIGNAL('clicked()'), self.close) self.connect(self.btn_create_backup, SIGNAL('clicked()'), self.create_backup)
def __init__(self, parent=None): QDialog.__init__(self, parent) self.setMaximumSize(QSize(0, 0)) self.setMinimumSize(500, 0) self.setWindowTitle('Minecraft Backup Manager - Configuration') #STANNDARD BUTTONS self.button_box = QDialogButtonBox(self) self.button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Save) #input_save_folder self.input_save_folder = QLineEdit(self) self.input_save_folder.setText(load_config('save_backup_folder')) self.input_save_folder.setToolTip('Default folder save backup') #change_save_folder self.btn_save_folder = QPushButton('Change', self) #LAYOUTS #Save Folder Layout self.layout_save_folder = QHBoxLayout() self.layout_save_folder.addWidget(QLabel('Save folder:', self)) self.layout_save_folder.addWidget(self.input_save_folder) self.layout_save_folder.addWidget(self.btn_save_folder) #Button Box Layout self.layout_button_box = QHBoxLayout() self.layout_button_box.setContentsMargins(0, 25, 0, 0) self.layout_button_box.addWidget(self.button_box) #Vertical Container Layout self.Vcontainer = QVBoxLayout(self) self.Vcontainer.addLayout(self.layout_save_folder) self.Vcontainer.addLayout(self.layout_button_box) #CONNECT SIGNALS self.connect(self.btn_save_folder, SIGNAL('clicked()'), self.change_save_folder) self.connect(self.button_box, SIGNAL('accepted()'), self.save_configurations) self.connect(self.button_box, SIGNAL('rejected()'), self.close)