From dec5ccd7a83bf72dd8e8af507e43e8490ad629a3 Mon Sep 17 00:00:00 2001 From: Marcel Kapfer Date: Thu, 10 Sep 2020 23:48:34 +0200 Subject: [PATCH] Active "add" buttons with enter keyboard Closes #4 --- ui_mainwindow.py | 66 ++++++++++++++++++++++++++++++++++++++---------- ui_mainwindow.ui | 54 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 14 deletions(-) diff --git a/ui_mainwindow.py b/ui_mainwindow.py index 6041ef5..1e1c0ec 100644 --- a/ui_mainwindow.py +++ b/ui_mainwindow.py @@ -101,6 +101,7 @@ class Ui_MainWindow(object): self.b_category_remove.setObjectName("b_category_remove") self.horizontalLayout_15.addWidget(self.b_category_remove) self.b_category_add = QtWidgets.QPushButton(self.t_basics) + self.b_category_add.setAutoDefault(True) self.b_category_add.setObjectName("b_category_add") self.horizontalLayout_15.addWidget(self.b_category_add) self.verticalLayout_8.addLayout(self.horizontalLayout_15) @@ -154,6 +155,7 @@ class Ui_MainWindow(object): self.b_ingredient_remove.setObjectName("b_ingredient_remove") self.horizontalLayout_13.addWidget(self.b_ingredient_remove) self.b_ingredient_add = QtWidgets.QPushButton(self.t_ingredients) + self.b_ingredient_add.setAutoDefault(True) self.b_ingredient_add.setObjectName("b_ingredient_add") self.horizontalLayout_13.addWidget(self.b_ingredient_add) self.verticalLayout_7.addLayout(self.horizontalLayout_13) @@ -187,6 +189,7 @@ class Ui_MainWindow(object): self.b_utensil_remove.setObjectName("b_utensil_remove") self.horizontalLayout_12.addWidget(self.b_utensil_remove) self.b_utensil_add = QtWidgets.QPushButton(self.t_utensils) + self.b_utensil_add.setAutoDefault(True) self.b_utensil_add.setObjectName("b_utensil_add") self.horizontalLayout_12.addWidget(self.b_utensil_add) self.verticalLayout_6.addLayout(self.horizontalLayout_12) @@ -206,6 +209,7 @@ class Ui_MainWindow(object): spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem7) self.b_step_add = QtWidgets.QPushButton(self.t_steps) + self.b_step_add.setAutoDefault(True) self.b_step_add.setObjectName("b_step_add") self.horizontalLayout_9.addWidget(self.b_step_add) self.verticalLayout_5.addLayout(self.horizontalLayout_9) @@ -239,6 +243,7 @@ class Ui_MainWindow(object): spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem9) self.b_note_add = QtWidgets.QPushButton(self.t_notes) + self.b_note_add.setAutoDefault(True) self.b_note_add.setObjectName("b_note_add") self.horizontalLayout_7.addWidget(self.b_note_add) self.verticalLayout_4.addLayout(self.horizontalLayout_7) @@ -272,6 +277,7 @@ class Ui_MainWindow(object): spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem11) self.b_tip_add = QtWidgets.QPushButton(self.t_tips) + self.b_tip_add.setAutoDefault(True) self.b_tip_add.setObjectName("b_tip_add") self.horizontalLayout_5.addWidget(self.b_tip_add) self.verticalLayout_2.addLayout(self.horizontalLayout_5) @@ -305,6 +311,7 @@ class Ui_MainWindow(object): spacerItem13 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem13) self.b_variation_add = QtWidgets.QPushButton(self.t_variations) + self.b_variation_add.setAutoDefault(True) self.b_variation_add.setObjectName("b_variation_add") self.horizontalLayout_3.addWidget(self.b_variation_add) self.verticalLayout_3.addLayout(self.horizontalLayout_3) @@ -338,6 +345,7 @@ class Ui_MainWindow(object): spacerItem15 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem15) self.b_rating_add = QtWidgets.QPushButton(self.t_rating) + self.b_rating_add.setAutoDefault(True) self.b_rating_add.setObjectName("b_rating_add") self.horizontalLayout_2.addWidget(self.b_rating_add) self.verticalLayout.addLayout(self.horizontalLayout_2) @@ -388,22 +396,52 @@ class Ui_MainWindow(object): MainWindow.setTabOrder(self.e_time, self.e_rating_overall) MainWindow.setTabOrder(self.e_rating_overall, self.e_url) MainWindow.setTabOrder(self.e_url, self.e_category) - MainWindow.setTabOrder(self.e_category, self.e_ingredient) + MainWindow.setTabOrder(self.e_category, self.b_category_add) + MainWindow.setTabOrder(self.b_category_add, self.v_categories) + MainWindow.setTabOrder(self.v_categories, self.b_category_remove) + MainWindow.setTabOrder(self.b_category_remove, self.e_ingredient) MainWindow.setTabOrder(self.e_ingredient, self.c_heading) MainWindow.setTabOrder(self.c_heading, self.e_amount) - MainWindow.setTabOrder(self.e_amount, self.v_ingredients) - MainWindow.setTabOrder(self.v_ingredients, self.e_utensil) - MainWindow.setTabOrder(self.e_utensil, self.v_utensils) - MainWindow.setTabOrder(self.v_utensils, self.e_step) - MainWindow.setTabOrder(self.e_step, self.v_steps) - MainWindow.setTabOrder(self.v_steps, self.e_note) - MainWindow.setTabOrder(self.e_note, self.v_notes) - MainWindow.setTabOrder(self.v_notes, self.e_tip) - MainWindow.setTabOrder(self.e_tip, self.v_tips) - MainWindow.setTabOrder(self.v_tips, self.e_variation) - MainWindow.setTabOrder(self.e_variation, self.v_variations) - MainWindow.setTabOrder(self.v_variations, self.e_rating) - MainWindow.setTabOrder(self.e_rating, self.v_ratings) + MainWindow.setTabOrder(self.e_amount, self.b_ingredient_add) + MainWindow.setTabOrder(self.b_ingredient_add, self.v_ingredients) + MainWindow.setTabOrder(self.v_ingredients, self.b_ingredient_remove) + MainWindow.setTabOrder(self.b_ingredient_remove, self.e_utensil) + MainWindow.setTabOrder(self.e_utensil, self.b_utensil_add) + MainWindow.setTabOrder(self.b_utensil_add, self.v_utensils) + MainWindow.setTabOrder(self.v_utensils, self.b_utensil_remove) + MainWindow.setTabOrder(self.b_utensil_remove, self.e_step) + MainWindow.setTabOrder(self.e_step, self.b_step_add) + MainWindow.setTabOrder(self.b_step_add, self.v_steps) + MainWindow.setTabOrder(self.v_steps, self.b_step_edit) + MainWindow.setTabOrder(self.b_step_edit, self.b_step_replace) + MainWindow.setTabOrder(self.b_step_replace, self.b_step_remove) + MainWindow.setTabOrder(self.b_step_remove, self.e_note) + MainWindow.setTabOrder(self.e_note, self.b_note_add) + MainWindow.setTabOrder(self.b_note_add, self.v_notes) + MainWindow.setTabOrder(self.v_notes, self.b_note_edit) + MainWindow.setTabOrder(self.b_note_edit, self.b_note_replace) + MainWindow.setTabOrder(self.b_note_replace, self.b_note_remove) + MainWindow.setTabOrder(self.b_note_remove, self.e_tip) + MainWindow.setTabOrder(self.e_tip, self.b_tip_add) + MainWindow.setTabOrder(self.b_tip_add, self.v_tips) + MainWindow.setTabOrder(self.v_tips, self.b_tip_edit) + MainWindow.setTabOrder(self.b_tip_edit, self.b_tip_replace) + MainWindow.setTabOrder(self.b_tip_replace, self.b_tip_remove) + MainWindow.setTabOrder(self.b_tip_remove, self.e_variation) + MainWindow.setTabOrder(self.e_variation, self.b_variation_add) + MainWindow.setTabOrder(self.b_variation_add, self.v_variations) + MainWindow.setTabOrder(self.v_variations, self.b_variation_edit) + MainWindow.setTabOrder(self.b_variation_edit, self.b_variation_replace) + MainWindow.setTabOrder(self.b_variation_replace, self.b_variation_remove) + MainWindow.setTabOrder(self.b_variation_remove, self.e_rating) + MainWindow.setTabOrder(self.e_rating, self.b_rating_add) + MainWindow.setTabOrder(self.b_rating_add, self.v_ratings) + MainWindow.setTabOrder(self.v_ratings, self.b_rating_edit) + MainWindow.setTabOrder(self.b_rating_edit, self.b_rating_replace) + MainWindow.setTabOrder(self.b_rating_replace, self.b_rating_remove) + MainWindow.setTabOrder(self.b_rating_remove, self.b_create) + MainWindow.setTabOrder(self.b_create, self.tabWidget) + MainWindow.setTabOrder(self.tabWidget, self.b_cancel) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate diff --git a/ui_mainwindow.ui b/ui_mainwindow.ui index 755b70f..b732a24 100644 --- a/ui_mainwindow.ui +++ b/ui_mainwindow.ui @@ -200,6 +200,9 @@ Hinzufügen + + true + @@ -314,6 +317,9 @@ Hinzufügen + + true + @@ -386,6 +392,9 @@ Hinzufügen + + true + @@ -435,6 +444,9 @@ Hinzufügen + + true + @@ -510,6 +522,9 @@ Hinzufügen + + true + @@ -585,6 +600,9 @@ Hinzufügen + + true + @@ -660,6 +678,9 @@ Hinzufügen + + true + @@ -735,6 +756,9 @@ Hinzufügen + + true + @@ -830,22 +854,52 @@ e_rating_overall e_url e_category + b_category_add + v_categories + b_category_remove e_ingredient c_heading e_amount + b_ingredient_add v_ingredients + b_ingredient_remove e_utensil + b_utensil_add v_utensils + b_utensil_remove e_step + b_step_add v_steps + b_step_edit + b_step_replace + b_step_remove e_note + b_note_add v_notes + b_note_edit + b_note_replace + b_note_remove e_tip + b_tip_add v_tips + b_tip_edit + b_tip_replace + b_tip_remove e_variation + b_variation_add v_variations + b_variation_edit + b_variation_replace + b_variation_remove e_rating + b_rating_add v_ratings + b_rating_edit + b_rating_replace + b_rating_remove + b_create + tabWidget + b_cancel