class Slider(QWidget): def __init__(self, parent, name): super().__init__(parent) self.name = name self.layout = QHBoxLayout(self) self.setLayout(self.layout) self.slider = QScrollBar(self) self.spin_box = QDoubleSpinBox(self) self.spin_box.setMaximumWidth(70) self.layout.addWidget(self.slider) self.layout.addWidget(self.spin_box) self.slider.setOrientation(QtCore.Qt.Horizontal) self.slider.setPageStep(1) self._slider_mult = 1 self._spin_val = QtPropertyVar(self.spin_box, 'value') self._slider_val = QtPropertyVar(self.slider, 'value') self._var = None self.set_from_value = None self._step = None self._min = None self._max = None self.var = Var(name='var') def _uses_integer(self): return isinstance(self._slider_mult, int) @reactive def _set_all_to(self, value): #print("set all to ", value) if self._min is not None and self._max is not None and self._min > self._max: set_if_inequal(self._var, None) return if self._uses_integer() and value is not None: value = int(round(value)) set_if_inequal(self._slider_val, value * self._slider_mult) set_if_inequal(self._spin_val, value) set_if_inequal(self._var, value) @property def var(self): return self._var @var.setter def var(self, var): with ScopedName(name=self.name): self._var = var if var is not None else Var(name='var') self.set_from_value = volatile(self._set_all_to(self._var)) def set_params(self, min, max, step=1): self._step = step self._min = min self._max = max if isinstance(min, float) or isinstance(max, float) or isinstance( step, float): self._slider_mult = 1.0 / step self.spin_box.setDecimals(int(ceil(-log10(step)))) else: self._slider_mult = 1 self.spin_box.setDecimals(0) self.slider.setRange(int(min * self._slider_mult), int(max * self._slider_mult)) self.slider.setSingleStep(int(step * self._slider_mult)) self.spin_box.setRange(min, max) self.spin_box.setSingleStep(step) with ScopedName(name=self.name): self.refs = [ volatile(self._set_all_to(self._spin_val)), volatile(self._set_all_to(self._slider_val / self._slider_mult)) ] val = unwrap_def(self._var, None) self.fix_value(max, min, val) def fix_value(self, max, min, val): if min > max: new_val = None elif val is None: new_val = min elif val > max: new_val = max elif val < min: new_val = min else: return set_if_inequal(self._var, new_val) def dump_state(self): return dict( # min=self._min, # max=self._max, # step=self._step, value=unwrap(self._var)) def load_state(self, state: dict): # self.set_params(state['min'], state['max'], state['step']) value = state['value'] if self._uses_integer() and value is not None: value = int(round(value)) self._var.set(value)
class PreviewWidgetStyle(QGroupBox): def __init__(self, parent=None): super().__init__(parent) self.setTitle(self.tr("Preview")) self.setMaximumHeight(220) self.setObjectName("groupBox") self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setObjectName("verticalLayout") self.tabWidget = QTabWidget(self) self.tabWidget.setObjectName("tabWidgetPreview") self.tab = QWidget() self.tab.setObjectName("tab") self.horizontalLayout = QHBoxLayout(self.tab) self.horizontalLayout.setObjectName("horizontalLayout") self.groupBox = QGroupBox(self.tab) self.groupBox.setTitle(self.tr("Group Box")) self.groupBox.setObjectName("groupBox") self.verticalLayout_2 = QVBoxLayout(self.groupBox) self.verticalLayout_2.setObjectName("verticalLayout_2") self.radioButton = QRadioButton(self.groupBox) self.radioButton.setText(self.tr("Radio Button")) self.radioButton.setChecked(True) self.radioButton.setObjectName("radioButton") self.verticalLayout_2.addWidget(self.radioButton) self.radioButton_2 = QRadioButton(self.groupBox) self.radioButton_2.setText(self.tr("Radio Button")) self.radioButton_2.setObjectName("radioButton_2") self.verticalLayout_2.addWidget(self.radioButton_2) self.line = QFrame(self.groupBox) self.line.setFrameShape(QFrame.HLine) self.line.setFrameShadow(QFrame.Sunken) self.line.setObjectName("line") self.verticalLayout_2.addWidget(self.line) self.checkBox = QCheckBox(self.groupBox) self.checkBox.setText(self.tr("Check Box")) self.checkBox.setChecked(True) self.checkBox.setObjectName("checkBox") self.verticalLayout_2.addWidget(self.checkBox) self.horizontalLayout.addWidget(self.groupBox) self.verticalLayout_3 = QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.progressBar = QProgressBar(self.tab) self.progressBar.setProperty("value", 75) self.progressBar.setObjectName("progressBar") self.verticalLayout_3.addWidget(self.progressBar) self.horizontalSlider = QSlider(self.tab) self.horizontalSlider.setProperty("value", 45) self.horizontalSlider.setSliderPosition(45) self.horizontalSlider.setOrientation(Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.verticalLayout_3.addWidget(self.horizontalSlider) self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.spinBox = QSpinBox(self.tab) self.spinBox.setObjectName("spinBox") self.horizontalLayout_2.addWidget(self.spinBox) self.pushButton = QPushButton(self.tab) self.pushButton.setText(self.tr("Button")) self.pushButton.setObjectName("pushButton") self.horizontalLayout_2.addWidget(self.pushButton) self.verticalLayout_3.addLayout(self.horizontalLayout_2) self.comboBox = QComboBox(self.tab) self.comboBox.setObjectName("comboBox") self.comboBox.addItem(self.tr("Combo Box")) self.verticalLayout_3.addWidget(self.comboBox) self.horizontalLayout.addLayout(self.verticalLayout_3) self.verticalScrollBar = QScrollBar(self.tab) self.verticalScrollBar.setPageStep(50) self.verticalScrollBar.setOrientation(Qt.Vertical) self.verticalScrollBar.setObjectName("verticalScrollBar") self.horizontalLayout.addWidget(self.verticalScrollBar) self.tabWidget.addTab(self.tab, self.tr("Tab 1")) self.tab_2 = QWidget() self.tab_2.setObjectName("tab_2") self.tabWidget.addTab(self.tab_2, self.tr("Tab 2")) self.verticalLayout.addWidget(self.tabWidget) self.pushButton.installEventFilter(self) self.pushButton.setFocusPolicy(Qt.NoFocus) self.radioButton.installEventFilter(self) self.radioButton.setFocusPolicy(Qt.NoFocus) self.radioButton_2.installEventFilter(self) self.radioButton_2.setFocusPolicy(Qt.NoFocus) self.checkBox.installEventFilter(self) self.checkBox.setFocusPolicy(Qt.NoFocus) self.comboBox.installEventFilter(self) self.comboBox.setFocusPolicy(Qt.NoFocus) self.spinBox.installEventFilter(self) self.spinBox.setFocusPolicy(Qt.NoFocus) self.horizontalSlider.installEventFilter(self) self.horizontalSlider.setFocusPolicy(Qt.NoFocus) self.verticalScrollBar.installEventFilter(self) self.verticalScrollBar.setFocusPolicy(Qt.NoFocus) self.tab.installEventFilter(self) self.tab.setFocusPolicy(Qt.NoFocus) self.tab_2.installEventFilter(self) self.tab_2.setFocusPolicy(Qt.NoFocus) self.tabWidget.installEventFilter(self) self.tabWidget.setFocusPolicy(Qt.NoFocus) self.tabWidget.currentChanged.connect(self.noClick) def noClick(self, x): self.tabWidget.setCurrentIndex(0) def eventFilter(self, obj, event): if self.pushButton: if event.type() == QEvent.MouseButtonRelease: return True elif event.type() == QEvent.MouseButtonPress: return True elif event.type() == QEvent.MouseButtonDblClick: return True else: return False else: super().eventFilter(obj, event)
class PreviewWidgetStyle(QGroupBox): def __init__(self, parent=None): super().__init__(parent) self.setTitle(self.tr("Preview")) self.setMaximumHeight(220) self.setObjectName("groupBox") self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setObjectName("verticalLayout") self.tabWidget = QTabWidget(self) self.tabWidget.setObjectName("tabWidgetPreview") self.tab = QWidget() self.tab.setObjectName("tab") self.horizontalLayout = QHBoxLayout(self.tab) self.horizontalLayout.setObjectName("horizontalLayout") self.groupBox = QGroupBox(self.tab) self.groupBox.setTitle(self.tr("Group Box")) self.groupBox.setObjectName("groupBox") self.verticalLayout_2 = QVBoxLayout(self.groupBox) self.verticalLayout_2.setObjectName("verticalLayout_2") self.radioButton = QRadioButton(self.groupBox) self.radioButton.setText(self.tr("Radio Button")) self.radioButton.setChecked(True) self.radioButton.setObjectName("radioButton") self.verticalLayout_2.addWidget(self.radioButton) self.radioButton_2 = QRadioButton(self.groupBox) self.radioButton_2.setText(self.tr("Radio Button")) self.radioButton_2.setObjectName("radioButton_2") self.verticalLayout_2.addWidget(self.radioButton_2) self.line = QFrame(self.groupBox) self.line.setFrameShape(QFrame.HLine) self.line.setFrameShadow(QFrame.Sunken) self.line.setObjectName("line") self.verticalLayout_2.addWidget(self.line) self.checkBox = QCheckBox(self.groupBox) self.checkBox.setText(self.tr("Check Box")) self.checkBox.setChecked(True) self.checkBox.setObjectName("checkBox") self.verticalLayout_2.addWidget(self.checkBox) self.horizontalLayout.addWidget(self.groupBox) self.verticalLayout_3 = QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.progressBar = QProgressBar(self.tab) self.progressBar.setProperty("value", 75) self.progressBar.setObjectName("progressBar") self.verticalLayout_3.addWidget(self.progressBar) self.horizontalSlider = QSlider(self.tab) self.horizontalSlider.setProperty("value", 45) self.horizontalSlider.setSliderPosition(45) self.horizontalSlider.setOrientation(Qt.Horizontal) self.horizontalSlider.setObjectName("horizontalSlider") self.verticalLayout_3.addWidget(self.horizontalSlider) self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.spinBox = QSpinBox(self.tab) self.spinBox.setObjectName("spinBox") self.horizontalLayout_2.addWidget(self.spinBox) self.pushButton = QPushButton(self.tab) self.pushButton.setText(self.tr("Button")) self.pushButton.setObjectName("pushButton") self.horizontalLayout_2.addWidget(self.pushButton) self.verticalLayout_3.addLayout(self.horizontalLayout_2) self.comboBox = QComboBox(self.tab) self.comboBox.setObjectName("comboBox") self.comboBox.addItem(self.tr("Combo Box")) self.verticalLayout_3.addWidget(self.comboBox) self.horizontalLayout.addLayout(self.verticalLayout_3) self.verticalScrollBar = QScrollBar(self.tab) self.verticalScrollBar.setPageStep(50) self.verticalScrollBar.setOrientation(Qt.Vertical) self.verticalScrollBar.setObjectName("verticalScrollBar") self.horizontalLayout.addWidget(self.verticalScrollBar) self.tabWidget.addTab(self.tab, self.tr("Tab 1")) self.tab_2 = QWidget() self.tab_2.setObjectName("tab_2") self.tabWidget.addTab(self.tab_2, self.tr("Tab 2")) self.verticalLayout.addWidget(self.tabWidget) self.pushButton.installEventFilter(self) self.pushButton.setFocusPolicy(Qt.NoFocus) self.radioButton.installEventFilter(self) self.radioButton.setFocusPolicy(Qt.NoFocus) self.radioButton_2.installEventFilter(self) self.radioButton_2.setFocusPolicy(Qt.NoFocus) self.checkBox.installEventFilter(self) self.checkBox.setFocusPolicy(Qt.NoFocus) self.comboBox.installEventFilter(self) self.comboBox.setFocusPolicy(Qt.NoFocus) self.spinBox.installEventFilter(self) self.spinBox.setFocusPolicy(Qt.NoFocus) self.horizontalSlider.installEventFilter(self) self.horizontalSlider.setFocusPolicy(Qt.NoFocus) self.verticalScrollBar.installEventFilter(self) self.verticalScrollBar.setFocusPolicy(Qt.NoFocus) self.tab.installEventFilter(self) self.tab.setFocusPolicy(Qt.NoFocus) self.tab_2.installEventFilter(self) self.tab_2.setFocusPolicy(Qt.NoFocus) self.tabWidget.installEventFilter(self) self.tabWidget.setFocusPolicy(Qt.NoFocus) self.tabWidget.currentChanged.connect(self.noClick) def noClick(self, x): self.tabWidget.setCurrentIndex(0) def eventFilter(self, obj, event): if self.pushButton: if event.type() == QEvent.MouseButtonRelease: return True elif event.type() == QEvent.MouseButtonPress: return True elif event.type() == QEvent.MouseButtonDblClick: return True else: return False else: super().eventFilter(obj, event)
def setupTab2(self, tab2): """Special widgets for preview panel""" scrollContainer = QVBoxLayout() scrollArea = QScrollArea() scrollArea.setWidgetResizable(True) mainWidget = QWidget() layout = QVBoxLayout() mainWidget.setLayout(layout) mainWidget.setMinimumSize(QSize(420, 800)) scrollArea.setWidget(mainWidget) scrollContainer.addWidget(scrollArea) tab2.setLayout(scrollContainer) # Dialog group0 = QGroupBox("Dialog") group1Layout = QVBoxLayout() layoutRow1 = QHBoxLayout() layoutRow2 = QHBoxLayout() group1Layout.addLayout(layoutRow1) group1Layout.addLayout(layoutRow2) group0.setLayout(group1Layout) layout.addWidget(group0) b1 = QPushButton(self.tr("Info")) b1.clicked.connect(lambda: QMessageBox.information( self, "Info", self.tr("This is a message."), QMessageBox.Ok, QMessageBox.Ok)) b2 = QPushButton(self.tr("Question")) b2.clicked.connect(lambda: QMessageBox.question( self, "question", self.tr("Are you sure?"), QMessageBox.No | QMessageBox.Yes, QMessageBox.Yes)) b3 = QPushButton(self.tr("Warning")) b3.clicked.connect(lambda: QMessageBox.warning( self, "warning", self.tr("This is a warning."), QMessageBox.No | QMessageBox.Yes, QMessageBox.Yes)) b4 = QPushButton(self.tr("Error")) b4.clicked.connect(lambda: QMessageBox.critical( self, "error", self.tr("It's a error."), QMessageBox.No | QMessageBox.Yes, QMessageBox.Yes)) b5 = QPushButton(self.tr("About")) b5.clicked.connect(lambda: QMessageBox.about( self, "about", self.tr("About this software"))) b6 = QPushButton(self.tr("Input")) # ,"输入对话框")) b6.clicked.connect(lambda: QInputDialog.getInt( self, self.tr("input"), self.tr("please input int"))) b6.clicked.connect(lambda: QInputDialog.getDouble( self, self.tr("input"), self.tr("please input float"))) b6.clicked.connect(lambda: QInputDialog.getItem( self, self.tr("input"), self.tr("please select"), ["aaa", "bbb"])) b7 = QPushButton(self.tr("Color")) # ,"颜色对话框")) b7.clicked.connect(lambda: QColorDialog.getColor()) b8 = QPushButton(self.tr("Font")) # ,"字体对话框")) b8.clicked.connect(lambda: QFontDialog.getFont()) b9 = QPushButton(self.tr("OpenFile")) # ,"打开对话框")) b9.clicked.connect(lambda: QFileDialog.getOpenFileName( self, "open", "", "Text(*.txt *.text)")) b10 = QPushButton(self.tr("SaveFile")) # ,"保存对话框")) b10.clicked.connect(lambda: QFileDialog.getSaveFileName()) layoutRow1.addWidget(b1) layoutRow1.addWidget(b2) layoutRow1.addWidget(b3) layoutRow1.addWidget(b4) layoutRow1.addWidget(b5) layoutRow2.addWidget(b6) layoutRow2.addWidget(b7) layoutRow2.addWidget(b8) layoutRow2.addWidget(b9) layoutRow2.addWidget(b10) # DateTime group1 = QGroupBox("DateTime") group1.setCheckable(True) group1Layout = QHBoxLayout() layoutRow1 = QVBoxLayout() layoutRow2 = QVBoxLayout() group1Layout.addLayout(layoutRow1) group1Layout.addLayout(layoutRow2) group1.setLayout(group1Layout) layout.addWidget(group1) group1.setMaximumHeight(240) dt1 = QDateEdit() dt1.setDate(QDate.currentDate()) dt2 = QTimeEdit() dt2.setTime(QTime.currentTime()) dt3 = QDateTimeEdit() dt3.setDateTime(QDateTime.currentDateTime()) dt4 = QDateTimeEdit() dt4.setCalendarPopup(True) dt5 = QCalendarWidget() dt5.setMaximumSize(QSize(250, 240)) layoutRow1.addWidget(dt1) layoutRow1.addWidget(dt2) layoutRow1.addWidget(dt3) layoutRow1.addWidget(dt4) layoutRow2.addWidget(dt5) # Slider group2 = QGroupBox("Sliders") group2.setCheckable(True) group2Layout = QVBoxLayout() layoutRow1 = QHBoxLayout() layoutRow2 = QHBoxLayout() group2Layout.addLayout(layoutRow1) group2Layout.addLayout(layoutRow2) group2.setLayout(group2Layout) layout.addWidget(group2) slider = QSlider() slider.setOrientation(Qt.Horizontal) slider.setMaximum(100) progress = QProgressBar() slider.valueChanged.connect(progress.setValue) slider.setValue(50) scroll1 = QScrollBar() scroll2 = QScrollBar() scroll3 = QScrollBar() scroll1.setMaximum(255) scroll2.setMaximum(255) scroll3.setMaximum(255) scroll1.setOrientation(Qt.Horizontal) scroll2.setOrientation(Qt.Horizontal) scroll3.setOrientation(Qt.Horizontal) c = QLabel(self.tr("Slide to change color")) # , "拖动滑块改变颜色")) c.setAutoFillBackground(True) c.setAlignment(Qt.AlignCenter) # c.setStyleSheet("border:1px solid gray;") c.setStyleSheet("background:rgba(0,0,0,100);") def clr(): # clr=QColor(scroll1.getValue(),scroll2.getValue(),scroll3.getValue(),100) # p=QPalette() # p.setColor(QPalette.Background,clr) # c.setPalette(p) c.setStyleSheet("background: rgba({},{},{},100);".format( scroll1.value(), scroll2.value(), scroll3.value())) scroll1.valueChanged.connect(clr) scroll2.valueChanged.connect(clr) scroll3.valueChanged.connect(clr) scroll1.setValue(128) layoutRow1.addWidget(slider) layoutRow1.addWidget(progress) layCol1 = QVBoxLayout() layCol1.addWidget(scroll1) layCol1.addWidget(scroll2) layCol1.addWidget(scroll3) layoutRow2.addLayout(layCol1) layoutRow2.addWidget(c) # Meter group3 = QGroupBox("Meters") group3.setCheckable(True) layRow = QHBoxLayout() group3.setLayout(layRow) layout.addWidget(group3) dial1 = QDial() dial2 = QDial() dial2.setNotchesVisible(True) dial1.valueChanged.connect(dial2.setValue) layRow.addWidget(dial1) layRow.addWidget(dial2) layout.addStretch(1)
class cardDetail(QDialog): def __init__(self, parent=None): super(cardDetail, self).__init__(parent) # Resize the page self.resize(600, 800) self.setWindowTitle("Ma carte de score") self.setupUi() def setupUi(self): # Create layout self.gridLayout = QGridLayout() self.verticalScrollBar = QScrollBar() self.verticalScrollBar.setOrientation(QtCore.Qt.Vertical) # Form generic structuration self.lbl_date = QtWidgets.QLabel("Date de jeu") self.gridLayout.addWidget(self.lbl_date, 0, 0, 1, 2) self.date_score = QtWidgets.QDateEdit(QDate.currentDate()) self.gridLayout.addWidget(self.date_score, 0, 2, 1, 3) self.lbl_course = QtWidgets.QLabel("Parcours") self.gridLayout.addWidget(self.lbl_course, 0, 5, 1, 2) self.cmb_course = QtWidgets.QComboBox() self.cmb_course.currentIndexChanged.connect(self.nbHoles) self.gridLayout.addWidget(self.cmb_course, 0, 7, 1, 3) self.lbl_speed = QtWidgets.QLabel("Vitesse de jeu") self.gridLayout.addWidget(self.lbl_speed, 1, 0, 1, 2) self.cmb_speed = QtWidgets.QComboBox() self.gridLayout.addWidget(self.cmb_speed, 1, 2, 1, 3) self.lbl_starter = QtWidgets.QLabel("Départ") self.gridLayout.addWidget(self.lbl_starter, 1, 5, 1, 2) self.cmb_starter = QtWidgets.QComboBox() self.gridLayout.addWidget(self.cmb_starter, 1, 7, 1, 3) self.lbl_weather = QtWidgets.QLabel("Météo") self.gridLayout.addWidget(self.lbl_weather, 2, 0, 1, 2) self.cmb_weather = QtWidgets.QComboBox() self.gridLayout.addWidget(self.cmb_weather, 2, 2, 1, 3) self.lbl_party = QtWidgets.QLabel("Type de partie") self.gridLayout.addWidget(self.lbl_party, 2, 5, 1, 2) self.cmb_party = QtWidgets.QComboBox() self.gridLayout.addWidget(self.cmb_party, 2, 7, 1, 3) self.lbl_balls = QtWidgets.QLabel("Mes balles") self.gridLayout.addWidget(self.lbl_balls, 3, 0, 1, 2) self.cmb_balls = QtWidgets.QComboBox() self.gridLayout.addWidget(self.cmb_balls, 3, 2, 1, 3) self.line = QtWidgets.QFrame() self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.gridLayout.addWidget(self.line, 4, 0, 2, 10) # Insert data in ComboBox self.lstCourses() self.lstWeather() self.lstSpeed() self.lstStarter() self.lstParty() self.lstBalls() # Form generic structuration Footer self.btn_valid = QtWidgets.QDialogButtonBox() self.btn_valid.setOrientation(QtCore.Qt.Horizontal) self.btn_valid.setStandardButtons( QtWidgets.QDialogButtonBox.Close | QtWidgets.QDialogButtonBox.Save) self.gridLayout.addWidget(self.btn_valid, 12, 6, 1, 4) self.btn_valid.accepted.connect(self.validForm) self.btn_valid.rejected.connect(self.close) self.setLayout(self.gridLayout) def bddConnect(self, request): try: conn = sqlite3.connect('golfstats.db') cur = conn.cursor() return cur.execute(request) cur.close() conn.close() except sqlite3.Error as error: print("Erreur lors de la connexion à SQLite", error) def nbHoles(self): hole_number = self.bddConnect("SELECT coursesholes FROM courses WHERE courses.idcourses = " + self.cmb_course.itemData(0)) j = 5 for i in range(hole_number.fetchone()[0]): print(i + 1) self.lbl_hole_1 = QtWidgets.QLabel("Trou " + str(i + 1)) self.gridLayout.addWidget(self.lbl_hole_1, j, 0, 2, 1) self.cmb_hole_1 = QtWidgets.QComboBox() self.gridLayout.addWidget(self.cmb_hole_1, j, 1, 2, 2) self.lbl_club_1 = QtWidgets.QLabel("Club") self.gridLayout.addWidget(self.lbl_club_1, j, 3, 2, 1) self.cmb_club_1 = QtWidgets.QComboBox() self.gridLayout.addWidget(self.cmb_club_1, j, 4, 2, 2) self.chk_farway_1 = QtWidgets.QCheckBox("Fairway") self.gridLayout.addWidget(self.chk_farway_1, j, 6, 2, 2) self.chk_green_1 = QtWidgets.QCheckBox("Green") self.gridLayout.addWidget(self.chk_green_1, j, 8, 2, 2) self.txt_comment_1 = QtWidgets.QTextEdit("") self.gridLayout.addWidget(self.txt_comment_1, j + 2, 0, 1, 10) self.line = QtWidgets.QFrame() self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.gridLayout.addWidget(self.line, j + 3, 0, 2, 10) j = j + 4 self.gridLayout.addWidget(self.verticalScrollBar, 0, 10, j - 4, 1) def lstCourses(self): liste_courses = self.bddConnect("SELECT courses.coursesname, courses.idcourses, golfs.golfsname FROM golfs, courses WHERE courses.idgolfs = golfs.idgolfs ORDER BY golfs.golfsname") for row in liste_courses: self.cmb_course.addItem(str(row[0] + " : " + row[2]), str(row[1])) def lstWeather(self): liste_weather = self.bddConnect("SELECT * FROM weather ORDER BY weathername") for row in liste_weather: self.cmb_weather.addItem(str(row[1]), str(row[0])) def lstSpeed(self): liste_speed = self.bddConnect("SELECT * FROM termes ORDER BY termesname") for row in liste_speed: self.cmb_speed.addItem(str(row[1]), str(row[0])) def lstStarter(self): liste_starter = self.bddConnect("SELECT * FROM starterballs ORDER BY starterballsname") for row in liste_starter: self.cmb_starter.addItem(str(row[1]), str(row[0])) def lstParty(self): liste_party = self.bddConnect("SELECT * FROM partytype ORDER BY partytypename") for row in liste_party: self.cmb_party.addItem(str(row[1]), str(row[0])) def lstBalls(self): liste_balls = self.bddConnect("SELECT * FROM balls ORDER BY ballsname") for row in liste_balls: self.cmb_balls.addItem(str(row[1]), str(row[0])) def validForm(self): pass