class KEpShow(QtGui.QWidget): """ Main class """ def on_show_activated(self, in_index): """ Load found tv show episodes infos """ index_showname = self.ui.found_tv_shows.model().index(in_index.row(), 1) current_disp = self.ui.found_tv_shows.model().data(index_showname) ix_dir = self.ui.found_tv_shows.model().index(in_index.row(), 2) current_dir = self.ui.found_tv_shows.model().data(ix_dir) parse_page(self.ui.tableView, current_disp, current_dir) #image = get_squared_pics_from_tvshow(current_disp) #if image: #self.ui.found_tv_shows.model().setData(self.ui.found_tv_shows.model().index(in_index.row(), 3), QtGui.QPixmap.fromImage(image.scaled(64, 64, QtCore.Qt.KeepAspectRatio)), QtCore.Qt.DecorationRole) #print(self.ui.found_tv_shows.model().data(index_showname)) def icon_selection(self, in_index): """ Handler for the thumbnails selection popup """ if in_index.column() == 3 : index_showname = self.ui.found_tv_shows.model().index(in_index.row(), 1) #current_disp = self.ui.found_tv_shows.model().data(index_showname).toString() print("try to open popup" + index_showname) #select = PicturesSelector(self, current_disp) def update_global(self, rank): """ Load all tv show episodes infos """ index_showname = self.ui.all_tv_shows.model().index(rank, 1) current_disp = self.ui.all_tv_shows.model().data(index_showname).toString() parse_page(self.ui.tableView, current_disp, "") #print self.ui.found_tv_shows.model().data(index_showname).toString() def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # Set up the user interface from Designer. self.ui = Ui_MainQWidget() self.ui.setupUi(self) self.ui.tableView.setAlternatingRowColors(True) self.connect(self.ui.found_tv_shows, QtCore.SIGNAL("activated(QModelIndex)"), self.on_show_activated) #self.connect(self.ui.found_tv_shows, QtCore.SIGNAL("entered(QModelIndex)"), self.icon_selection) #self.connect(self.ui.all_tv_shows, QtCore.SIGNAL("currentIndexChanged(int)"), self.update_global) def directory_selector(self): """ Opens a popup to choose a directory containing tv shows """ dir_full_path = QtGui.QFileDialog.getExistingDirectory(self, self.tr("Choose a directory"), QtCore.QDir.currentPath(), QtGui.QFileDialog.DontResolveSymlinks | QtGui.QFileDialog.ShowDirsOnly ) if not dir_full_path.isEmpty(): DIRECTORIES_TO_PARSE.append(dir_full_path) self.write_dirs_to_xml()
class KEpShow(QtWidgets.QWidget): """ Main class """ def on_show_activated(self, in_index): """ Load found tv show episodes infos """ index_showname = self.ui.found_tv_shows.model().index( in_index.row(), 1) current_disp = self.ui.found_tv_shows.model().data(index_showname) ix_dir = self.ui.found_tv_shows.model().index(in_index.row(), 2) current_dir = self.ui.found_tv_shows.model().data(ix_dir) parse_tvmaze_page(self.ui.tableView, current_disp, current_dir) #image = get_squared_pics_from_tvshow(current_disp) #if image: #self.ui.found_tv_shows.model().setData(self.ui.found_tv_shows.model().index(in_index.row(), 3), QtWidgets.QPixmap.fromImage(image.scaled(64, 64, QtCore.Qt.KeepAspectRatio)), QtCore.Qt.DecorationRole) #print(self.ui.found_tv_shows.model().data(index_showname)) def icon_selection(self, in_index): """ Handler for the thumbnails selection popup """ if in_index.column() == 3: index_showname = self.ui.found_tv_shows.model().index( in_index.row(), 1) #current_disp = self.ui.found_tv_shows.model().data(index_showname).toString() print("try to open popup" + index_showname) #select = PicturesSelector(self, current_disp) def update_global(self, rank): """ Load all tv show episodes infos """ index_showname = self.ui.all_tv_shows.model().index(rank, 1) current_disp = self.ui.all_tv_shows.model().data( index_showname).toString() parse_epguides_page(self.ui.tableView, current_disp, "") #print self.ui.found_tv_shows.model().data(index_showname).toString() def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) # Set up the user interface from Designer. self.ui = Ui_MainQWidget() self.ui.setupUi(self) self.ui.tableView.setAlternatingRowColors(True) self.ui.found_tv_shows.activated[QtCore.QModelIndex].connect( self.on_show_activated) #self.connect(self.ui.found_tv_shows, QtCore.SIGNAL("entered(QModelIndex)"), self.icon_selection) #self.connect(self.ui.all_tv_shows, QtCore.SIGNAL("currentIndexChanged(int)"), self.update_global) def directory_selector(self): """ Opens a popup to choose a directory containing tv shows """ dir_full_path = QtWidgets.QFileDialog.getExistingDirectory( self, self.tr("Choose a directory"), QtCore.QDir.currentPath(), QtWidgets.QFileDialog.DontResolveSymlinks | QtWidgets.QFileDialog.ShowDirsOnly) if not dir_full_path.isEmpty(): DIRECTORIES_TO_PARSE.append(dir_full_path) self.write_dirs_to_xml()
def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) # Set up the user interface from Designer. self.ui = Ui_MainQWidget() self.ui.setupUi(self) self.ui.tableView.setAlternatingRowColors(True) self.ui.found_tv_shows.activated[QtCore.QModelIndex].connect( self.on_show_activated)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # Set up the user interface from Designer. self.ui = Ui_MainQWidget() self.ui.setupUi(self) self.ui.tableView.setAlternatingRowColors(True) self.connect(self.ui.found_tv_shows, QtCore.SIGNAL("activated(QModelIndex)"), self.on_show_activated)