1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
def build_shots(self):
# Get selected episode
self.my_get_episode = self.my_input_episode.currentText()
self.my_console.setText("Episode : "+self.my_get_episode)
self.my_console.setStyleSheet("color:white")
# Get selected episode
self.my_get_steps = self.my_input_steps.currentText()
self.my_console.setText("Episode : "+self.my_get_episode + " --- "+self.my_get_steps )
self.my_console.setStyleSheet("color:green;font-weight:bold")
# change the color of my_input_episode and my_input_steps
if self.my_get_episode != "":
self.my_input_episode.setStyleSheet("background-color:#004666")
else:
self.my_input_episode.setStyleSheet("background-color:#4F4F4F")
if self.my_get_steps != "":
self.my_input_steps.setStyleSheet("background-color:#004666")
else:
self.my_input_steps.setStyleSheet("background-color:#4F4F4F")
# HERE WE BUILD THE BUTTONS
if self.my_get_steps != "" and self.my_get_episode != "":
# Build shots
my_list_shots = ['']
for x in xrange(1,100):
my_list_shots.append(str(x))
x=2 # line 1 has the menu
y=1 # row
incrementLineX=1 # every 10 we go to line 2 (x+1) and reset incrementLine and y (row) to 1
for i in xrange(1,121):
try:
my_shot_number=my_list_shots[i]
my_shot_number = "%03d"%int(my_shot_number)
self.buttons = QtWidgets.QPushButton(my_shot_number,self)
self.buttons.setStyleSheet("background-color:brown;color:white")
self.buttons.clicked.connect(partial(self.my_open_mov,my_shot_number))
self.my_grid_layout.addWidget(self.buttons,x,y,1,1)
except Exception as e:
self.buttons = QtWidgets.QPushButton("",self)
self.buttons.setEnabled(False)
my_shot_number=""
y=y+1
incrementLineX=incrementLineX+1
if incrementLineX>10:
x=x+1
y=1
incrementLineX = 1 |
Partager