def __init__( self, app, parent ):
self.app = app
super().__init__( parent )
self.setWindowTitle( T_('Lock files') )
self.details = QtWidgets.QPlainTextEdit( '' )
self.message = QtWidgets.QPlainTextEdit( '' )
self.force = QtWidgets.QCheckBox( T_('force files to be locked') )
self.force.setCheckState( QtCore.Qt.Unchecked )
em = self.fontMetrics().width( 'M' )
self.addNamedDivider( 'Files to Lock' )
self.addRow( None, self.details, min_width=60*em )
self.addNamedDivider( 'Lock Message' )
self.addRow( None, self.message )
self.addRow( T_('Force'), self.force )
self.addButtons()
python类QCheckBox()的实例源码
def _layout(self):
"""
Create layout.
"""
self._main_layout = QW.QHBoxLayout(self)
if self._input_type is bool:
self._select_widget = QW.QCheckBox()
self._select_widget.stateChanged.connect(self._bool_handler)
self._select_widget.setChecked(self._initial_value)
elif self._input_type is str:
self._select_widget = QW.QLineEdit()
self._select_widget.editingFinished.connect(self._str_handler)
self._select_widget.setText(self._initial_value)
elif self._input_type is int:
self._select_widget = QW.QLineEdit()
self._select_widget.editingFinished.connect(self._int_handler)
self._select_widget.setText(str(self._initial_value))
else:
self._select_widget = QW.QLineEdit()
self._select_widget.editingFinished.connect(self._general_handler)
self._select_widget.setText(str(self._initial_value))
self._main_layout.addWidget(self._select_widget)
def __init__( self, app, parent, folder_name ):
self.app = app
super().__init__( parent )
self.setWindowTitle( T_('Add Folder') )
self.depth = WbSvnDepthWidget( include_empty=True, default=pysvn.depth.empty )
self.force = QtWidgets.QCheckBox( T_('force files to be added') )
self.force.setCheckState( QtCore.Qt.Unchecked )
self.addRow( T_('Folder'), folder_name )
self.addRow( T_('Depth'), self.depth )
self.addRow( T_('Force'), self.force )
self.addButtons()
def __init__( self, app, parent ):
self.app = app
super().__init__( parent )
self.setWindowTitle( T_('UnLock files') )
self.details = QtWidgets.QPlainTextEdit( '' )
self.force = QtWidgets.QCheckBox( T_('force files to be unlocked') )
self.force.setCheckState( QtCore.Qt.Unchecked )
em = self.fontMetrics().width( 'M' )
self.addNamedDivider( 'Files to Unlock' )
self.addRow( None, self.details, min_width=60*em )
self.addRow( T_('Force'), self.force )
self.addButtons()
def __init__( self, parent, trust_info ):
super().__init__( parent )
self.setWindowTitle( T_('SVN SSL Server Trust') )
self.realm = QtWidgets.QLabel( trust_info['realm'] )
self.save_trust = QtWidgets.QCheckBox()
self.save_trust.setCheckState( QtCore.Qt.Unchecked )
em = self.fontMetrics().width( 'M' )
self.addRow( T_('Hostname'), trust_info['hostname'], min_width=50*em )
self.addRow( T_('Finger Print'), trust_info['finger_print'] )
self.addRow( T_('Valid From'), trust_info['valid_from'] )
self.addRow( T_('Valid Until'), trust_info['valid_until'] )
self.addRow( T_('Issuer Dname'), trust_info['issuer_dname'] )
self.addRow( T_('Realm'), trust_info['realm'] )
self.addRow( T_('Save Trust'), self.save_trust )
self.addButtons()
def __init__(self, option, value):
# Make sure the value is a boolean
if isinstance(value, str):
if value.lower() in ['yes', "true", "on"]:
value = True
elif value in ['no', "false", "off"]:
value = False
super().__init__(option)
self.check_box = QW.QCheckBox()
self.check_box.setChecked(value)
self.answer = QW.QLabel()
self.switch_answer()
self.check_box.clicked.connect(self.switch_answer)
self.layout.addWidget(self.check_box)
self.layout.addWidget(self.answer)
def read_settings(self):
settings = QtCore.QSettings(self._application, self._section)
for key in settings.allKeys():
value = settings.value(key)
try:
# This is required to skip the tab_position key/value
this = getattr(self.ui, key)
except:
continue
if isinstance(this, QW.QLineEdit):
this.setText(value)
elif isinstance(this, QW.QSpinBox):
this.setValue(int(value))
elif isinstance(this, QW.QCheckBox):
if value in ['false', False, "False"]:
this.setChecked(False)
else:
this.setChecked(True)
elif isinstance(this, FileBrowser):
this.set_filenames(value)
else:
print('could not handle : %s' % this)
# The last tab position
self._tab_pos = settings.value("tab_position", 0, type=int)
self.ui.tabs.setCurrentIndex(self._tab_pos)
def get_settings(self):
# get all items to save in settings
items = {}
names = self._get_widget_names()
for name in names:
widget = getattr(self.ui, name)
if isinstance(widget, QW.QLineEdit):
value = widget.text()
elif isinstance(widget, QW.QSpinBox):
value = widget.value()
elif isinstance(widget, QW.QCheckBox):
value = widget.isChecked()
elif isinstance(widget, QW.QSpinBox):
value = widget.value()
elif isinstance(widget, FileBrowser):
value = widget.get_filenames()
else:
raise NotImplementedError("for developers")
items[name] = value
items["tab_position"] = self.ui.tabs.currentIndex()
return items
def get_option(self):
"""Return option and its value as a list
An option may be without any value, but we still return a list
e.G. ["--verbose"] or ["--cores", "2"]
"""
if isinstance(self.widget, QW.QCheckBox):
if self.widget.isChecked() is True:
return ["--" + self.name]
else:
value = self._get_value()
if value is None or value in ["", '', "''", '""']:
return []
else:
return ["--" + self.name, value]
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle('Manual Add Server')
self.form = QtWidgets.QFormLayout(self)
self.secure = QtWidgets.QCheckBox()
self.address = QtWidgets.QLineEdit()
self.port = QtWidgets.QLineEdit('32400')
self.token = QtWidgets.QLineEdit()
self.form.addRow(QtWidgets.QLabel('HTTPS?'), self.secure)
self.form.addRow(QtWidgets.QLabel('Address'), self.address)
self.form.addRow(QtWidgets.QLabel('Port'), self.port)
self.form.addRow(QtWidgets.QLabel('Access Token (optional)'), self.token)
self.buttons = QtWidgets.QDialogButtonBox(
QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)
self.form.addRow(self.buttons)
self.buttons.rejected.connect(self.reject)
self.buttons.accepted.connect(self.accept)
def setLang(self, langName):
uiList_lang_read = self.memoData['lang'][langName]
for ui_name in uiList_lang_read:
ui_element = self.uiList[ui_name]
if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]:
# uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
if uiList_lang_read[ui_name] != "":
ui_element.setText(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]:
# uiType: QMenu, QGroupBox
if uiList_lang_read[ui_name] != "":
ui_element.setTitle(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QTabWidget]:
# uiType: QTabWidget
tabCnt = ui_element.count()
if uiList_lang_read[ui_name] != "":
tabNameList = uiList_lang_read[ui_name].split(';')
if len(tabNameList) == tabCnt:
for i in range(tabCnt):
if tabNameList[i] != "":
ui_element.setTabText(i,tabNameList[i])
elif type(ui_element) == str:
# uiType: string for msg
if uiList_lang_read[ui_name] != "":
self.uiList[ui_name] = uiList_lang_read[ui_name]
universal_tool_template_0904.py 文件源码
项目:universal_tool_template.py
作者: shiningdesign
项目源码
文件源码
阅读 30
收藏 0
点赞 0
评论 0
def setLang(self, langName):
uiList_lang_read = self.memoData['lang'][langName]
for ui_name in uiList_lang_read:
ui_element = self.uiList[ui_name]
if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]:
# uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
if uiList_lang_read[ui_name] != "":
ui_element.setText(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]:
# uiType: QMenu, QGroupBox
if uiList_lang_read[ui_name] != "":
ui_element.setTitle(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QTabWidget]:
# uiType: QTabWidget
tabCnt = ui_element.count()
if uiList_lang_read[ui_name] != "":
tabNameList = uiList_lang_read[ui_name].split(';')
if len(tabNameList) == tabCnt:
for i in range(tabCnt):
if tabNameList[i] != "":
ui_element.setTabText(i,tabNameList[i])
elif type(ui_element) == str:
# uiType: string for msg
if uiList_lang_read[ui_name] != "":
self.uiList[ui_name] = uiList_lang_read[ui_name]
universal_tool_template_0803.py 文件源码
项目:universal_tool_template.py
作者: shiningdesign
项目源码
文件源码
阅读 21
收藏 0
点赞 0
评论 0
def setLang(self, langName):
uiList_lang_read = self.memoData['lang'][langName]
for ui_name in uiList_lang_read:
ui_element = self.uiList[ui_name]
if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]:
# uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
if uiList_lang_read[ui_name] != "":
ui_element.setText(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]:
# uiType: QMenu, QGroupBox
if uiList_lang_read[ui_name] != "":
ui_element.setTitle(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QTabWidget]:
# uiType: QTabWidget
tabCnt = ui_element.count()
if uiList_lang_read[ui_name] != "":
tabNameList = uiList_lang_read[ui_name].split(';')
if len(tabNameList) == tabCnt:
for i in range(tabCnt):
if tabNameList[i] != "":
ui_element.setTabText(i,tabNameList[i])
elif type(ui_element) == str:
# uiType: string for msg
if uiList_lang_read[ui_name] != "":
self.uiList[ui_name] = uiList_lang_read[ui_name]
universal_tool_template_v8.1.py 文件源码
项目:universal_tool_template.py
作者: shiningdesign
项目源码
文件源码
阅读 34
收藏 0
点赞 0
评论 0
def setLang(self, langName):
uiList_lang_read = self.memoData['lang'][langName]
for ui_name in uiList_lang_read:
ui_element = self.uiList[ui_name]
if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]:
# uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
if uiList_lang_read[ui_name] != "":
ui_element.setText(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]:
# uiType: QMenu, QGroupBox
if uiList_lang_read[ui_name] != "":
ui_element.setTitle(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QTabWidget]:
# uiType: QTabWidget
tabCnt = ui_element.count()
if uiList_lang_read[ui_name] != "":
tabNameList = uiList_lang_read[ui_name].split(';')
if len(tabNameList) == tabCnt:
for i in range(tabCnt):
if tabNameList[i] != "":
ui_element.setTabText(i,tabNameList[i])
elif type(ui_element) == str:
# uiType: string for msg
if uiList_lang_read[ui_name] != "":
self.uiList[ui_name] = uiList_lang_read[ui_name]
Buttons_QCheckBox_00_basic.py 文件源码
项目:OpenTutorials_PyQt
作者: RavenKyu
项目源码
文件源码
阅读 24
收藏 0
点赞 0
评论 0
def __init__(self):
QWidget.__init__(self, flags=Qt.Widget)
self.setWindowTitle("CheckBox")
# ??? ?? ?? ??
cb_1 = QCheckBox("CheckBox 1")
cb_2 = QCheckBox("CheckBox 2")
cb_3 = QCheckBox("CheckBox 3")
cb_4 = QCheckBox("CheckBox 4")
cb_5 = QCheckBox("CheckBox 5")
# ???? ?? ? Form Widget? ??
base_layout = QBoxLayout(QBoxLayout.TopToBottom, self)
base_layout.addWidget(cb_1)
base_layout.addWidget(cb_2)
base_layout.addWidget(cb_3)
base_layout.addWidget(cb_4)
base_layout.addWidget(cb_5)
self.setLayout(base_layout)
Buttons_QCheckBox_01_change_state.py 文件源码
项目:OpenTutorials_PyQt
作者: RavenKyu
项目源码
文件源码
阅读 27
收藏 0
点赞 0
评论 0
def __init__(self):
QWidget.__init__(self, flags=Qt.Widget)
self.setWindowTitle("CheckBox")
base_layout = QBoxLayout(QBoxLayout.TopToBottom, self)
self.setLayout(base_layout)
# ??? ?? ?? ??
self.lb = QLabel()
base_layout.addWidget(self.lb)
# CheckBox ?? ?? ? ??? ??
self.cb_list = list()
for i in range(2):
w = QCheckBox("CheckBox %s" % i)
w.stateChanged.connect(self._confirm)
base_layout.addWidget(w)
self.cb_list.append(w)
# ?? ?? ??? ??
self._confirm()
def setupUi(self, Form):
Form.setObjectName("Form")
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
Form.setSizePolicy(sizePolicy)
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setObjectName("verticalLayout")
self.groupBox = QtWidgets.QGroupBox(Form)
self.groupBox.setObjectName("groupBox")
self.formLayout = QtWidgets.QFormLayout(self.groupBox)
self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout.setObjectName("formLayout")
self.fitInterceptLabel = QtWidgets.QLabel(self.groupBox)
self.fitInterceptLabel.setObjectName("fitInterceptLabel")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.fitInterceptLabel)
self.fitInterceptCheckBox = QtWidgets.QCheckBox(self.groupBox)
self.fitInterceptCheckBox.setChecked(True)
self.fitInterceptCheckBox.setObjectName("fitInterceptCheckBox")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.fitInterceptCheckBox)
self.verticalLayout.addWidget(self.groupBox)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def my_close(self):
settings = constants.SETTINGS
not_show = settings.value('not_show_close_dialog', False, type=bool)
if not not_show:
cb = QCheckBox("Do not show this again.")
msgbox = QMessageBox(QMessageBox.Question, "Confirm close", "Are you sure you want to close?")
msgbox.addButton(QMessageBox.Yes)
msgbox.addButton(QMessageBox.No)
msgbox.setDefaultButton(QMessageBox.No)
msgbox.setCheckBox(cb)
reply = msgbox.exec()
not_show_again = bool(cb.isChecked())
settings.setValue("not_show_close_dialog", not_show_again)
self.not_show_again_changed.emit()
if reply != QMessageBox.Yes:
return
self.closed.emit(self)
def init_middle_layout(self):
if not self.should_show:
return
vbox = QtWidgets.QVBoxLayout()
self.select_all = QtWidgets.QCheckBox('Select All ')
self.filter_sub_funcs = QtWidgets.QCheckBox('Filter Out "sub_" functions ')
vbox.addWidget(self.filter_sub_funcs)
vbox.addWidget(self.select_all)
format_str = '{} functions'.format(self.total_functions)
self.function_number = QtWidgets.QLabel(format_str)
self.function_number.setAlignment(Qt.AlignTop)
self.middle_layout.addWidget(self.function_number)
self.middle_layout.addStretch()
self.middle_layout.addLayout(vbox)
def init_middle_layout(self):
found = len(self.groups)
total = len(FIRST.Metadata.get_non_jmp_wrapped_functions())
s = 's' if 1 != total else ''
label = 'Matched {0} out of {1} function{2}'
self.select_highest_ranked = QtWidgets.QCheckBox('Select Highest Ranked ')
self.filter_sub_funcs_only = QtWidgets.QCheckBox('Show only "sub_" functions')
vbox = QtWidgets.QVBoxLayout()
vbox.addWidget(self.filter_sub_funcs_only)
vbox.addWidget(self.select_highest_ranked)
self.found_format = label.format('{}', total, s)
self.found_label = QtWidgets.QLabel(self.found_format.format(found))
self.found_label.setAlignment(Qt.AlignTop)
self.middle_layout.addWidget(self.found_label)
self.middle_layout.addStretch()
self.middle_layout.addLayout(vbox)
def _bool_handler(self,value):
"""
Handler for bool values. Parses QCheckBox.
"""
value = self._select_widget.checkState()
self._current_value = value
self._valid = True
def layout(self):
# --------------- Guess -----------------
self._guess = QW.QLineEdit()
self._guess.editingFinished.connect(self._guess_handler)
self._current_guess = None
# --------------- Lower -----------------
self._lower = QW.QLineEdit()
self._lower.editingFinished.connect(self._lower_handler)
self._current_lower = None
# --------------- Upper -----------------
self._upper = QW.QLineEdit()
self._upper.editingFinished.connect(self._upper_handler)
self._current_upper = None
# --------------- Fixed -----------------
self._fixed = QW.QCheckBox()
self._fixed.stateChanged.connect(self._fixed_handler)
self._current_fixed = None
# --------------- Alias -----------------
self._alias = QW.QComboBox()
self._alias.addItem("Unlink")
self._alias.addItem("Add global")
self._alias.addItem("Add connector")
self._alias.currentIndexChanged.connect(self._alias_handler)
self._current_alias = None
# Load in parameters from FitParameter object
self.update()
def __init__(self,parent,fit,experiment,settable_name,start_value,value_type,
allowable_values,float_view_cutoff=100000):
"""
parent: parent widget
fit: FitContainer object
experiment: pytc.ITCExperiment object containing settable
settable_name: name of settable (string) in experiment object
start_value: starting value of settable when widget opens
value_type: value type.
bool -> QCheckBox
str,float,int -> QLineEdit, parsed appropriately
multi -> QDropDown, using allowable_values to populate
allowable_value: list of available values for multi, None otherwise
float_view_cutoff: how to show floats in QLineEdit boxes
"""
super().__init__()
self._parent = parent
self._fit = fit
self._experiment = experiment
self._settable_name = settable_name
self._start_value = start_value
self._value_type = value_type
self._allowable_values = allowable_values
self._float_view_cutoff = float_view_cutoff
self._current_value = self._start_value
self.layout()
def update(self):
"""
Update widget based on what's actually in the experiment.
"""
value = getattr(self._experiment,self._settable_name)
if self._current_value != value:
# --------- multi value ----------
if self._value_type == "multi":
current_index = self._select_widget.findText(value)
if current_index == -1:
err = "current value is not in the allowable values\n"
raise ValueError(err)
self._select_widget.setCurrentIndex(current_index)
# --------- bool value --------------
elif self._value_type == bool:
self._select_widget = QW.QCheckBox()
self._select_widget.setChecked(value)
# -------- other values --------------
else:
if self._value_type == float:
if value < 1/self._float_view_cutoff or value > self._float_view_cutoff:
val_str = "{:.8e}".format(value)
else:
val_str = "{:.8f}".format(value)
else:
val_str = "{}".format(value)
self._select_widget.setText(val_str)
def saveSettings(self):
lineEdit_filemaskregex = self.findChild(QLineEdit, "lineEdit_filemaskregex")
cfg.settings.setValue('Options/FilemaskRegEx', lineEdit_filemaskregex.text())
lineEdit_mediainfo_path = self.findChild(QLineEdit, "lineEdit_mediainfo_path")
cfg.settings.setValue('Paths/mediainfo_bin', lineEdit_mediainfo_path.text())
lineEdit_mp3guessenc_path = self.findChild(QLineEdit, "lineEdit_mp3guessenc_path")
cfg.settings.setValue('Paths/mp3guessenc_bin', lineEdit_mp3guessenc_path.text())
lineEdit_aucdtect_path = self.findChild(QLineEdit, "lineEdit_aucdtect_path")
cfg.settings.setValue('Paths/aucdtect_bin', lineEdit_aucdtect_path.text())
lineEdit_sox_path = self.findChild(QLineEdit, "lineEdit_sox_path")
cfg.settings.setValue('Paths/sox_bin', lineEdit_sox_path.text())
lineEdit_ffprobe_path = self.findChild(QLineEdit, "lineEdit_ffprobe_path")
cfg.settings.setValue('Paths/ffprobe_bin', lineEdit_ffprobe_path.text())
checkBox_recursive = self.findChild(QCheckBox, "checkBox_recursive")
cfg.settings.setValue('Options/RecurseDirectories', checkBox_recursive.isChecked())
checkBox_followsymlinks = self.findChild(QCheckBox, "checkBox_followsymlinks")
cfg.settings.setValue('Options/FollowSymlinks', checkBox_followsymlinks.isChecked())
checkBox_cache = self.findChild(QCheckBox, "checkBox_cache")
cfg.settings.setValue('Options/UseCache', checkBox_cache.isChecked())
checkBox_cacheraw = self.findChild(QCheckBox, "checkBox_cacheraw")
cfg.settings.setValue('Options/CacheRawOutput', checkBox_cacheraw.isChecked())
spinBox_processes = self.findChild(QSpinBox, "spinBox_processes")
cfg.settings.setValue('Options/Processes', spinBox_processes.value())
spinBox_spectrogram_palette = self.findChild(QSpinBox, "spinBox_spectrogram_palette")
cfg.settings.setValue('Options/SpectrogramPalette', spinBox_spectrogram_palette.value())
checkBox_debug = self.findChild(QCheckBox, "checkBox_debug")
cfg.settings.setValue('Options/Debug', checkBox_debug.isChecked())
cfg.debug_enabled = checkBox_debug.isChecked()
checkBox_savewindowstate = self.findChild(QCheckBox, "checkBox_savewindowstate")
cfg.settings.setValue('Options/SaveWindowState', checkBox_savewindowstate.isChecked())
checkBox_clearfilelist = self.findChild(QCheckBox, "checkBox_clearfilelist")
cfg.settings.setValue('Options/ClearFilelist', checkBox_clearfilelist.isChecked())
checkBox_spectrogram = self.findChild(QCheckBox, "checkBox_spectrogram")
cfg.settings.setValue('Options/EnableSpectrogram', checkBox_spectrogram.isChecked())
checkBox_bitrate_graph = self.findChild(QCheckBox, "checkBox_bitrate_graph")
cfg.settings.setValue('Options/EnableBitGraph', checkBox_bitrate_graph.isChecked())
checkBox_aucdtect_scan = self.findChild(QCheckBox, "checkBox_aucdtect_scan")
cfg.settings.setValue('Options/auCDtect_scan', checkBox_aucdtect_scan.isChecked())
horizontalSlider_aucdtect_mode = self.findChild(QSlider, "horizontalSlider_aucdtect_mode")
cfg.settings.setValue('Options/auCDtect_mode', horizontalSlider_aucdtect_mode.value())
self.close()
def __init__( self, wizard ):
super().__init__( wizard )
self.setTitle( T_('Add Git Project') )
self.setSubTitle( T_('Clone Git repository') )
#------------------------------------------------------------
v = wb_dialog_bases.WbValidateUrl( all_supported_schemes,
T_('Fill in the upstream URL') )
self.url_upstream = wb_dialog_bases.WbLineEdit( '', validator=v )
self.setup_upstream = wb_dialog_bases.WbCheckBox(
T_('git remote upstream. Usually required when using a forked repository'),
False )
self.setup_upstream.stateChanged.connect( self.url_upstream.setEnabled )
self.url_upstream.setEnabled( False )
self.setup_upstream.stateChanged.connect( self._fieldsChanged )
self.url_upstream.textChanged.connect( self._fieldsChanged )
#------------------------------------------------------------
self.pull_rebase = QtWidgets.QCheckBox( T_('git pull --rebase') )
self.pull_rebase.setChecked( True )
#------------------------------------------------------------
self.grid_layout.addNamedDivider( T_('git remote origin') )
self.grid_layout.addRow( T_('Repository URL'), self.url )
self.grid_layout.addNamedDivider( T_('git remote upstream') )
self.grid_layout.addRow( T_('remote upstream'), self.setup_upstream )
self.grid_layout.addRow( T_('upstream URL'), self.url_upstream )
self.grid_layout.addNamedDivider( T_('git config --local') )
self.grid_layout.addRow( T_('pull.rebase'), self.pull_rebase )
self.grid_layout.addFeedbackWidget()
def __init__( self, dialog, name, present ):
self.dialog = dialog
self.name = name
self.was_present = present
self.starting_value = ''
self.value_ctrl = None
self.checkbox = QtWidgets.QCheckBox( name )
self.checkbox.setCheckState( QtCore.Qt.Checked if present else QtCore.Qt.Unchecked )
def __init__( self, app ):
super().__init__( app, T_('Commit Log History') )
if self.app is None:
self.prefs = None
else:
self.prefs = self.app.prefs.log_history
self.default_limit = QtWidgets.QSpinBox()
self.default_limit.setRange( 1, 100000 )
self.default_limit.setSuffix( T_(' Commits') )
self.use_default_limit = QtWidgets.QCheckBox( T_('Use limit') )
self.default_until = QtWidgets.QSpinBox()
self.default_until.setRange( 1, 365 )
self.default_until.setSuffix( T_(' days') )
self.use_default_until = QtWidgets.QCheckBox( T_('Use until') )
self.default_since = QtWidgets.QSpinBox()
self.default_since.setRange( 2, 365 )
self.default_since.setSuffix( T_(' days') )
self.use_default_since = QtWidgets.QCheckBox( T_('Use since') )
if self.prefs is not None:
self.default_limit.setValue( self.prefs.default_limit )
self.use_default_limit.setChecked( self.prefs.use_default_limit )
self.default_until.setValue( self.prefs.default_until_days_interval )
self.use_default_until.setChecked( self.prefs.use_default_until_days_interval )
self.default_since.setValue( self.prefs.default_since_days_interval )
self.use_default_since.setChecked( self.prefs.use_default_since_days_interval )
self.addRow( T_('Default Limit'), self.default_limit, self.use_default_limit )
self.addRow( T_('Default until interval'), self.default_until, self.use_default_until )
self.addRow( T_('Default since interval'), self.default_since, self.use_default_since )
self.default_until.valueChanged.connect( self.__untilChanged )
def __init__(self, parent=None):
super().__init__(parent)
self.setSubTitle(self.tr("<h2>Welcome to KaOS</h2>"))
vlayout = QVBoxLayout(self)
vlayout.addItem(QSpacerItem(20, 30, QSizePolicy.Preferred, QSizePolicy.Minimum))
hlayout = QHBoxLayout(self)
label = QLabel(self)
label.setText(self.tr("""<h1>What is KaOS?</h1>
<p>The idea behind KaOS is to create a tightly integrated rolling and<br />
transparent distribution for the modern desktop, build from scratch with<br />
a very specific focus. Focus on one DE (KDE), one toolkit (Qt) & one architecture (x86_64).<br />
Plus a focus on evaluating and selecting the most suitable tools and applications.</p>
<p>This wizard will help you personalize your KaOS workspace easily and quickly.</p>
<p>Please click <code style=color:#3498DB>Next</code> in order to begin. Click <code style=color:#3498DB>Cancel</code> anytime and changes won't be saved.</p>"""))
label.setWordWrap(True)
label.setAlignment(Qt.AlignLeft)
hlayout.addWidget(label)
kaptan_logo = QLabel(self)
kaptan_logo.setPixmap(QPixmap(":/data/images/welcome.png"))
kaptan_logo.setAlignment(Qt.AlignRight)
kaptan_logo.setMaximumSize(157, 181)
hlayout.addWidget(kaptan_logo)
vlayout.addLayout(hlayout)
vlayout.addItem(QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))
desktop_file = os.path.join(os.environ["HOME"], ".config", "autostart", "kaptan.desktop")
if os.path.exists(desktop_file):
self.checkBox = QCheckBox()
self.checkBox.setText(self.tr("Run on system startup"))
self.checkBox.setChecked(True)
self.checkBox.clicked.connect(self.autoRemove)
vlayout.addWidget(self.checkBox)
def setupUi(self, filter):
filter.setObjectName("filter")
filter.resize(381, 435)
self.gridLayout = QtWidgets.QGridLayout(filter)
self.gridLayout.setObjectName("gridLayout")
self.buttonBox = QtWidgets.QDialogButtonBox(filter)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 1)
self.label_2 = QtWidgets.QLabel(filter)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1)
self.listWidget = QtWidgets.QListWidget(filter)
self.listWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.listWidget.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
self.listWidget.setObjectName("listWidget")
self.gridLayout.addWidget(self.listWidget, 2, 0, 1, 1)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(filter)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.lineEdit = QtWidgets.QLineEdit(filter)
self.lineEdit.setInputMask("")
self.lineEdit.setPlaceholderText("")
self.lineEdit.setObjectName("lineEdit")
self.horizontalLayout.addWidget(self.lineEdit)
self.checkBox = QtWidgets.QCheckBox(filter)
self.checkBox.setObjectName("checkBox")
self.horizontalLayout.addWidget(self.checkBox)
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
self.label_2.raise_()
self.listWidget.raise_()
self.buttonBox.raise_()
self.label.raise_()
self.retranslateUi(filter)
self.buttonBox.accepted.connect(filter.accept)
self.buttonBox.rejected.connect(filter.reject)
QtCore.QMetaObject.connectSlotsByName(filter)