Skip to content

Commit

Permalink
update: card setting feature is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Yejining committed Feb 12, 2020
1 parent dfda779 commit 3ea7665
Show file tree
Hide file tree
Showing 4 changed files with 347 additions and 89 deletions.
6 changes: 4 additions & 2 deletions MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ def __init__(self):

def init_objects(self):
self.database = Database(self.table, self.lineEdit_dbid, self.checkBox_dbid)
self.form = Inputs(self.lineEdit_pupiltimer, self.lineEdit_seqsize,
self.form = Inputs(self.lineEdit_dbid, self.checkBox_dbid,
self.lineEdit_pupiltimer, self.lineEdit_seqsize,
self.lineEdit_boardsizen, self.lineEdit_boardsizem, self.sequence,
self.lineEdit_dwell)
self.card, self.lineEdit_dwell,
self.radioButton_on, self.radioButton_off)
self.error = Error()

def add_button_clicked(self):
Expand Down
190 changes: 137 additions & 53 deletions gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ def __init__(self):
self.matrix = []


class Card:
def __init__(self):
self.width = 0
self.height = 0
self.horizontal_margin = 0
self.vertical_margin = 0


class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(684, 1036)
MainWindow.resize(684, 1366)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
Expand Down Expand Up @@ -186,89 +194,150 @@ def setupUi(self, MainWindow):
self.box_board.setObjectName("box_board")
self.gridLayout_15 = QtWidgets.QGridLayout(self.box_board)
self.gridLayout_15.setObjectName("gridLayout_15")
self.lineEdit_board02 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board02.setObjectName("lineEdit_board02")
self.gridLayout_15.addWidget(self.lineEdit_board02, 1, 2, 1, 1)
self.lineEdit_board04 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board04.setObjectName("lineEdit_board04")
self.gridLayout_15.addWidget(self.lineEdit_board04, 1, 4, 1, 1)
self.lineEdit_board03 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board03.setObjectName("lineEdit_board03")
self.gridLayout_15.addWidget(self.lineEdit_board03, 1, 3, 1, 1)
self.lineEdit_board01 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board01.setObjectName("lineEdit_board01")
self.gridLayout_15.addWidget(self.lineEdit_board01, 1, 1, 1, 1)
self.lineEdit_board32 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board32.setObjectName("lineEdit_board32")
self.gridLayout_15.addWidget(self.lineEdit_board32, 4, 2, 1, 1)
self.lineEdit_board03 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board03.setObjectName("lineEdit_board03")
self.gridLayout_15.addWidget(self.lineEdit_board03, 1, 3, 1, 1)
self.lineEdit_board02 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board02.setObjectName("lineEdit_board02")
self.gridLayout_15.addWidget(self.lineEdit_board02, 1, 2, 1, 1)
self.lineEdit_board14 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board14.setObjectName("lineEdit_board14")
self.gridLayout_15.addWidget(self.lineEdit_board14, 2, 4, 1, 1)
self.lineEdit_board00 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board00.setObjectName("lineEdit_board00")
self.gridLayout_15.addWidget(self.lineEdit_board00, 1, 0, 1, 1)
self.lineEdit_board10 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board10.setObjectName("lineEdit_board10")
self.gridLayout_15.addWidget(self.lineEdit_board10, 2, 0, 1, 1)
self.lineEdit_board31 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board31.setObjectName("lineEdit_board31")
self.gridLayout_15.addWidget(self.lineEdit_board31, 4, 1, 1, 1)
self.lineEdit_board11 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board11.setObjectName("lineEdit_board11")
self.gridLayout_15.addWidget(self.lineEdit_board11, 2, 1, 1, 1)
self.lineEdit_board24 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board24.setObjectName("lineEdit_board24")
self.gridLayout_15.addWidget(self.lineEdit_board24, 3, 4, 1, 1)
self.lineEdit_board14 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board14.setObjectName("lineEdit_board14")
self.gridLayout_15.addWidget(self.lineEdit_board14, 2, 4, 1, 1)
self.lineEdit_board21 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board21.setObjectName("lineEdit_board21")
self.gridLayout_15.addWidget(self.lineEdit_board21, 3, 1, 1, 1)
self.lineEdit_board23 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board23.setObjectName("lineEdit_board23")
self.gridLayout_15.addWidget(self.lineEdit_board23, 3, 3, 1, 1)
self.lineEdit_board20 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board20.setObjectName("lineEdit_board20")
self.gridLayout_15.addWidget(self.lineEdit_board20, 3, 0, 1, 1)
self.lineEdit_board22 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board22.setObjectName("lineEdit_board22")
self.gridLayout_15.addWidget(self.lineEdit_board22, 3, 2, 1, 1)
self.lineEdit_board31 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board31.setObjectName("lineEdit_board31")
self.gridLayout_15.addWidget(self.lineEdit_board31, 4, 1, 1, 1)
self.lineEdit_board32 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board32.setObjectName("lineEdit_board32")
self.gridLayout_15.addWidget(self.lineEdit_board32, 4, 2, 1, 1)
self.lineEdit_board30 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board30.setObjectName("lineEdit_board30")
self.gridLayout_15.addWidget(self.lineEdit_board30, 4, 0, 1, 1)
self.lineEdit_board33 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board33.setObjectName("lineEdit_board33")
self.gridLayout_15.addWidget(self.lineEdit_board33, 4, 3, 1, 1)
self.lineEdit_board30 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board30.setObjectName("lineEdit_board30")
self.gridLayout_15.addWidget(self.lineEdit_board30, 4, 0, 1, 1)
self.lineEdit_board34 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board34.setObjectName("lineEdit_board34")
self.gridLayout_15.addWidget(self.lineEdit_board34, 4, 4, 1, 1)
self.lineEdit_board22 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board22.setObjectName("lineEdit_board22")
self.gridLayout_15.addWidget(self.lineEdit_board22, 3, 2, 1, 1)
self.lineEdit_board13 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board13.setObjectName("lineEdit_board13")
self.gridLayout_15.addWidget(self.lineEdit_board13, 2, 3, 1, 1)
self.lineEdit_board12 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board12.setObjectName("lineEdit_board12")
self.gridLayout_15.addWidget(self.lineEdit_board12, 2, 2, 1, 1)
self.lineEdit_board24 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board24.setObjectName("lineEdit_board24")
self.gridLayout_15.addWidget(self.lineEdit_board24, 3, 4, 1, 1)
self.lineEdit_board40 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board40.setObjectName("lineEdit_board40")
self.gridLayout_15.addWidget(self.lineEdit_board40, 5, 0, 1, 1)
self.lineEdit_board41 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board41.setObjectName("lineEdit_board41")
self.gridLayout_15.addWidget(self.lineEdit_board41, 5, 1, 1, 1)
self.lineEdit_board42 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board42.setObjectName("lineEdit_board42")
self.gridLayout_15.addWidget(self.lineEdit_board42, 5, 2, 1, 1)
self.lineEdit_board20 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board20.setObjectName("lineEdit_board20")
self.gridLayout_15.addWidget(self.lineEdit_board20, 3, 0, 1, 1)
self.lineEdit_board10 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board10.setObjectName("lineEdit_board10")
self.gridLayout_15.addWidget(self.lineEdit_board10, 2, 0, 1, 1)
self.lineEdit_board04 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board04.setObjectName("lineEdit_board04")
self.gridLayout_15.addWidget(self.lineEdit_board04, 1, 4, 1, 1)
self.lineEdit_board43 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board43.setObjectName("lineEdit_board43")
self.gridLayout_15.addWidget(self.lineEdit_board43, 5, 3, 1, 1)
self.lineEdit_board42 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board42.setObjectName("lineEdit_board42")
self.gridLayout_15.addWidget(self.lineEdit_board42, 5, 2, 1, 1)
self.lineEdit_board44 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board44.setObjectName("lineEdit_board44")
self.gridLayout_15.addWidget(self.lineEdit_board44, 5, 4, 1, 1)
self.lineEdit_board41 = QtWidgets.QLineEdit(self.box_board)
self.lineEdit_board41.setObjectName("lineEdit_board41")
self.gridLayout_15.addWidget(self.lineEdit_board41, 5, 1, 1, 1)
self.verticalLayout_2.addWidget(self.box_board)
self.box_card = QtWidgets.QGroupBox(self.box_game)
self.box_card.setObjectName("box_card")
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.box_card)
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_width = QtWidgets.QLabel(self.box_card)
self.label_width.setObjectName("label_width")
self.horizontalLayout.addWidget(self.label_width)
spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem4)
self.lineEdit_width = QtWidgets.QLineEdit(self.box_card)
self.lineEdit_width.setObjectName("lineEdit_width")
self.horizontalLayout.addWidget(self.lineEdit_width)
self.label_widthpx = QtWidgets.QLabel(self.box_card)
self.label_widthpx.setObjectName("label_widthpx")
self.horizontalLayout.addWidget(self.label_widthpx)
self.verticalLayout_5.addLayout(self.horizontalLayout)
self.horizontalLayout_10 = QtWidgets.QHBoxLayout()
self.horizontalLayout_10.setObjectName("horizontalLayout_10")
self.label_height = QtWidgets.QLabel(self.box_card)
self.label_height.setObjectName("label_height")
self.horizontalLayout_10.addWidget(self.label_height)
spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_10.addItem(spacerItem5)
self.lineEdit_height = QtWidgets.QLineEdit(self.box_card)
self.lineEdit_height.setObjectName("lineEdit_height")
self.horizontalLayout_10.addWidget(self.lineEdit_height)
self.label_heightpx = QtWidgets.QLabel(self.box_card)
self.label_heightpx.setObjectName("label_heightpx")
self.horizontalLayout_10.addWidget(self.label_heightpx)
self.verticalLayout_5.addLayout(self.horizontalLayout_10)
self.horizontalLayout_11 = QtWidgets.QHBoxLayout()
self.horizontalLayout_11.setObjectName("horizontalLayout_11")
self.label_marginh = QtWidgets.QLabel(self.box_card)
self.label_marginh.setObjectName("label_marginh")
self.horizontalLayout_11.addWidget(self.label_marginh)
spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_11.addItem(spacerItem6)
self.lineEdit_marginh = QtWidgets.QLineEdit(self.box_card)
self.lineEdit_marginh.setObjectName("lineEdit_marginh")
self.horizontalLayout_11.addWidget(self.lineEdit_marginh)
self.label_marginhpx = QtWidgets.QLabel(self.box_card)
self.label_marginhpx.setObjectName("label_marginhpx")
self.horizontalLayout_11.addWidget(self.label_marginhpx)
self.verticalLayout_5.addLayout(self.horizontalLayout_11)
self.horizontalLayout_12 = QtWidgets.QHBoxLayout()
self.horizontalLayout_12.setObjectName("horizontalLayout_12")
self.label_marginv = QtWidgets.QLabel(self.box_card)
self.label_marginv.setObjectName("label_marginv")
self.horizontalLayout_12.addWidget(self.label_marginv)
spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_12.addItem(spacerItem7)
self.lineEdit_marginv = QtWidgets.QLineEdit(self.box_card)
self.lineEdit_marginv.setObjectName("lineEdit_marginv")
self.horizontalLayout_12.addWidget(self.lineEdit_marginv)
self.label_marginvpx = QtWidgets.QLabel(self.box_card)
self.label_marginvpx.setObjectName("label_marginvpx")
self.horizontalLayout_12.addWidget(self.label_marginvpx)
self.verticalLayout_5.addLayout(self.horizontalLayout_12)
self.verticalLayout_2.addWidget(self.box_card)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.label_dwell = QtWidgets.QLabel(self.box_game)
self.label_dwell.setObjectName("label_dwell")
self.horizontalLayout_5.addWidget(self.label_dwell)
spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_5.addItem(spacerItem4)
spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_5.addItem(spacerItem8)
self.lineEdit_dwell = QtWidgets.QLineEdit(self.box_game)
self.lineEdit_dwell.setObjectName("lineEdit_dwell")
self.horizontalLayout_5.addWidget(self.lineEdit_dwell)
Expand All @@ -295,12 +364,12 @@ def setupUi(self, MainWindow):
self.label_bubble = QtWidgets.QLabel(self.frame_bubble)
self.label_bubble.setObjectName("label_bubble")
self.hLayout_bubble.addWidget(self.label_bubble)
spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.hLayout_bubble.addItem(spacerItem5)
spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.hLayout_bubble.addItem(spacerItem9)
self.radioButton_on = QtWidgets.QRadioButton(self.frame_bubble)
self.radioButton_on.setChecked(True)
self.radioButton_on.setObjectName("radioButton_on")
self.hLayout_bubble.addWidget(self.radioButton_on)
self.radioButton_on.setChecked(True)
self.radioButton_off = QtWidgets.QRadioButton(self.frame_bubble)
self.radioButton_off.setObjectName("radioButton_off")
self.hLayout_bubble.addWidget(self.radioButton_off)
Expand Down Expand Up @@ -352,8 +421,8 @@ def setupUi(self, MainWindow):
self.pushButton_apply.setObjectName("pushButton_apply")
self.hLayout_setting.addWidget(self.pushButton_apply)
self.gridLayout_6.addLayout(self.hLayout_setting, 1, 0, 1, 1)
spacerItem6 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_6.addItem(spacerItem6, 2, 0, 1, 1)
spacerItem10 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_6.addItem(spacerItem10, 2, 0, 1, 1)
self.gridLayout_2.addWidget(self.box_setting, 0, 0, 1, 1)
self.stack.addWidget(self.page_database)
self.page_shortcuts = QtWidgets.QWidget()
Expand All @@ -373,8 +442,8 @@ def setupUi(self, MainWindow):
self.label_shortcut1Name.setAlignment(QtCore.Qt.AlignCenter)
self.label_shortcut1Name.setObjectName("label_shortcut1Name")
self.hLayout_shortcut1.addWidget(self.label_shortcut1Name)
spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.hLayout_shortcut1.addItem(spacerItem7)
spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.hLayout_shortcut1.addItem(spacerItem11)
self.label_shortcut1 = QtWidgets.QLabel(self.box_shortcuts)
self.label_shortcut1.setObjectName("label_shortcut1")
self.hLayout_shortcut1.addWidget(self.label_shortcut1)
Expand All @@ -386,17 +455,17 @@ def setupUi(self, MainWindow):
self.label_shortcut2Name.setAlignment(QtCore.Qt.AlignCenter)
self.label_shortcut2Name.setObjectName("label_shortcut2Name")
self.hLayout_shortcut2.addWidget(self.label_shortcut2Name)
spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.hLayout_shortcut2.addItem(spacerItem8)
spacerItem12 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.hLayout_shortcut2.addItem(spacerItem12)
self.label_shortcut2 = QtWidgets.QLabel(self.box_shortcuts)
self.label_shortcut2.setObjectName("label_shortcut2")
self.hLayout_shortcut2.addWidget(self.label_shortcut2)
self.vLayout_shortcuts.addLayout(self.hLayout_shortcut2)
self.pushButton_ok = QtWidgets.QPushButton(self.box_shortcuts)
self.pushButton_ok.setObjectName("pushButton_ok")
self.vLayout_shortcuts.addWidget(self.pushButton_ok)
spacerItem9 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.vLayout_shortcuts.addItem(spacerItem9)
spacerItem13 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.vLayout_shortcuts.addItem(spacerItem13)
self.gridLayout_5.addLayout(self.vLayout_shortcuts, 0, 0, 1, 1)
self.gridLayout_4.addWidget(self.box_shortcuts, 0, 0, 1, 1)
self.stack.addWidget(self.page_shortcuts)
Expand Down Expand Up @@ -429,6 +498,15 @@ def retranslateUi(self, MainWindow):
self.label_5.setText(_translate("MainWindow", "x"))
self.pushButton_boardsize.setText(_translate("MainWindow", "Apply"))
self.box_board.setTitle(_translate("MainWindow", "Board Setting"))
self.box_card.setTitle(_translate("MainWindow", "Card Setting"))
self.label_width.setText(_translate("MainWindow", "Width:"))
self.label_widthpx.setText(_translate("MainWindow", "px"))
self.label_height.setText(_translate("MainWindow", "Height:"))
self.label_heightpx.setText(_translate("MainWindow", "px"))
self.label_marginh.setText(_translate("MainWindow", "Horizontal Margin:"))
self.label_marginhpx.setText(_translate("MainWindow", "px"))
self.label_marginv.setText(_translate("MainWindow", "Vertical Margin:"))
self.label_marginvpx.setText(_translate("MainWindow", "px"))
self.label_dwell.setText(_translate("MainWindow", "Dwell Timer:"))
self.label_dwellunit.setText(_translate("MainWindow", "second(s)"))
self.label_bubble.setText(_translate("MainWindow", "Gaze Visalizaition"))
Expand Down Expand Up @@ -513,6 +591,12 @@ def initializeClass(self):
row.append(self.lineEdit_board44)
self.sequence.matrix.append(row)

self.card = Card()
self.card.width = self.lineEdit_width
self.card.height = self.lineEdit_height
self.card.horizontal_margin = self.lineEdit_marginh
self.card.vertical_margin = self.lineEdit_marginv


if __name__ == "__main__":
import sys
Expand Down
Loading

0 comments on commit 3ea7665

Please sign in to comment.