Skip to content

Commit

Permalink
feat: edit label is automatically filled
Browse files Browse the repository at this point in the history
  • Loading branch information
Yejining committed Feb 12, 2020
1 parent 626f39c commit bbfc0f3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
23 changes: 22 additions & 1 deletion MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from src.game.GameWindow import GameWindow
from src.input.database import Database
from src.exception import Error
from src.input.form import Inputs
from src.input.form import Inputs, Basic
from src.input.parser import Parser


Expand All @@ -33,6 +33,7 @@ def __init__(self):
self.add_checkbox_changed()
self.add_edit_entered()
self.hide_boxes()
self.write_basics()

def init_objects(self):
self.database = Database(self.table, self.lineEdit_dbid, self.checkBox_dbid)
Expand All @@ -42,6 +43,7 @@ def init_objects(self):
self.card, self.lineEdit_dwell,
self.radioButton_on, self.radioButton_off)
self.error = Error()
self.basic = Basic()

def add_button_clicked(self):
self.pushButton_shortcuts.clicked.connect(self.on_click)
Expand All @@ -66,6 +68,25 @@ def hide_boxes(self):
self.box_detailed.hide()
self.box_board.hide()

def write_basics(self):
self.lineEdit_pupiltimer.setText(str(self.basic.lineEdit_pupiltimer))
self.lineEdit_seqsize.setText(str(self.basic.lineEdit_seqsize))
self.show_sequence_matrix()
for i in range(self.form.seqsize):
self.form.sequence.elements[i].setText(self.basic.sequence[i])
self.lineEdit_seqtimer.setText(str(self.basic.lineEdit_seqtimer))
self.lineEdit_boardsizen.setText(str(self.basic.lineEdit_boardsizen))
self.lineEdit_boardsizem.setText(str(self.basic.lineEdit_boardsizem))
self.show_board_matrix()
for i in range(self.basic.lineEdit_boardsizem):
for j in range(self.basic.lineEdit_boardsizen):
self.form.sequence.matrix[i][j].setText(self.basic.matrix[i][j])
self.lineEdit_width.setText(str(self.basic.lineEdit_width))
self.lineEdit_height.setText(str(self.basic.lineEdit_height))
self.lineEdit_marginh.setText(str(self.basic.lineEdit_marginh))
self.lineEdit_marginv.setText(str(self.basic.lineEdit_marginv))
self.lineEdit_dwell.setText(str(self.basic.lineEdit_dwell))

@pyqtSlot()
def on_click(self):
sending_button = self.sender()
Expand Down
20 changes: 20 additions & 0 deletions src/input/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,23 @@ def is_card_filled(self):
def is_dwell_timer_numer(self):
error = is_value_number(self.lineEdit_dwell.displayText(), "Dwell Timer")
return error


class Basic:
def __init__(self):
self.lineEdit_pupiltimer = 3
self.lineEdit_seqsize = 4
self.sequence = ['A', 'B', 'C', 'D']
self.lineEdit_seqtimer = 5
self.lineEdit_boardsizen = 3
self.lineEdit_boardsizem = 4
self.matrix = [['A', 'B', 'C'],
['D', 'E', 'F'],
['G', 'H', 'I'],
['J', 'K', 'L']]
self.lineEdit_width = 50
self.lineEdit_height = 50
self.lineEdit_marginh = 10
self.lineEdit_marginv = 10
self.lineEdit_dwell = 3000

0 comments on commit bbfc0f3

Please sign in to comment.