def load_shows_to_layout(self, listwidget): studio_shows = studioShows.Connect() data, rollback_data, sort_data = studio_shows.getShowAllData() listwidget.clear() for each_show in sort_data: current_icon = data[ rollback_data[each_show]][each_show]['show_icon'] display_name = data[ rollback_data[each_show]][each_show]['display_name'] tooltip = data[rollback_data[each_show]][each_show]['tooltip'] self.show_data.setdefault( each_show, data[rollback_data[each_show]][each_show]) item = QtGui.QListWidgetItem() listwidget.addItem(item) item.setText(display_name) item.setToolTip(tooltip) item.setStatusTip(each_show) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(current_icon), QtGui.QIcon.Normal, QtGui.QIcon.Off) item.setIcon(icon) item.setTextAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignBottom)
def set_current_show(self): studio_shows = studioShows.Connect() current_data = studio_shows.getShows() self.input_datas = self.get_widget_data(self.gridlayout) self.show_widget = None self.description_widget = None for k, v in self.input_datas.items(): if k=='current_show': self.show_widget = v['widget'] if k=='description': self.description_widget = v['widget'] self.show_widget.addItems(['None'] + current_data) self.show_widget.currentIndexChanged.connect(partial(self.set_show, self.show_widget)) self.show_widget.setCurrentIndex(1)
def create(self): input_data = self.get_data(self.gridlayout) studio_shows = studioShows.Connect() studio_shows.create(input_data)
def set_show(self, current_widget, *args): self.current_show = str(current_widget.currentText()) studio_shows = studioShows.Connect() show_iocn = studio_shows.getSpecificValue(self.current_show, 'show_icon') self.image_to_button(self.button_show, show_iocn, 256, 144)