Exemplo n.º 1
0
 def _editEpisode(self):
   moveItemCandidateData, isMoveItemCandidate = self._model.data(self._current_index, tv_model.RAW_DATA_ROLE)
   if isMoveItemCandidate and moveItemCandidateData.canEdit():
     seasonData, isMoveItemCandidate = self._model.data(self._current_index.parent(), tv_model.RAW_DATA_ROLE)
     utils.verify(not isMoveItemCandidate, "Must be move item")
     self._change_episode_widget.setItem(seasonData, moveItemCandidateData)
     self._change_episode_widget.show()
Exemplo n.º 2
0
 def _editSeason(self):
   seasonData, isMoveItemCandidate = self._model.data(self._current_index, tv_model.RAW_DATA_ROLE)
   if isMoveItemCandidate:
     self._current_index  = self._current_index.parent()
     seasonData, isMoveItemCandidate = self._model.data(self._current_index, tv_model.RAW_DATA_ROLE)
   utils.verify(not isMoveItemCandidate, "Must be a movie to have gotten here!")
   self._change_season_widget.setItem(seasonData)
   self._change_season_widget.show()
Exemplo n.º 3
0
 def _moveUp(self):
   currentItem = self.episode_table.currentItem()
   utils.verify(currentItem, "Must have current item to get here")
   nextItem = self.episode_table.item(currentItem.row() - 1, _TITLE_COLUMN)
   temp = nextItem.text()
   nextItem.setText(currentItem.text())
   currentItem.setText(temp)
   self.episode_table.setCurrentItem(nextItem)
   self._onSelectionChanged()
Exemplo n.º 4
0
def prettyTime(start_time):
  secs = time.clock() - start_time
  utils.verify(secs >= 0, "Can't be negative")
  if secs < 60:
    return "{:.1f} secs".format(secs)
  mins = secs / 60
  if mins < 60:
    return "{:.1f} mins".format(mins)
  hours = secs / (60 * 60)
  return "{:.1f} hours".format(hours)
Exemplo n.º 5
0
  def __init__(self, mode, parent=None):
    utils.verify(mode in base_types.VALID_MODES, "mode must be valid")
    super(WelcomeWidget, self).__init__(parent)
    uic.loadUi("ui/ui_Welcome.ui", self)
    self.setWindowTitle("Welcome to {}".format(app.__NAME__))
    self.setWindowModality(True)

    if mode == base_types.MOVIE_MODE:
      self.movie_radio.setChecked(True)
    else:
      self.tv_radio.setChecked(True)
Exemplo n.º 6
0
    def setData(self, model, index, value, role):
        if not index.isValid():
            return False
        ret = False

        if role == RAW_DATA_ROLE:
            parent_item = self.parent
            parentIndex = index.parent()
            utils.verify(parent_item.isSeason(), "Not a Season")

            model.beginRemoveRows(parentIndex, 0, parent_item.childCount() - 1)
            parent_item.raw.setEpisodeForFilename(value, self.raw.filename)
            parent_item.child_items = []
            for move_item in parent_item.raw.episode_move_items:
                parent_item.appendChild(LeafItem(move_item, parent_item))
            model.endRemoveRows()
            ret = True
        elif role == QtCore.Qt.CheckStateRole and index.column() == Columns.COL_OLD_NAME:
            self.setCheckState(value)
            model.dataChanged.emit(index, index)
            # model.dataChanged.emit(index.parent(), index.parent())
            ret = True
        return ret
Exemplo n.º 7
0
 def showEvent(self, _event):
   """ protected Qt function """
   utils.verify(self.episode_combo_box.count() > 0, "No items in list")
   self.setMaximumHeight(self.sizeHint().height())
   self.setMinimumHeight(self.sizeHint().height())
Exemplo n.º 8
0
 def _remove(self):
   currentItem = self.episode_table.currentItem()
   utils.verify(currentItem, "Must have current item to get here")
   self.episode_table.removeRow(currentItem.row())
   self._onSelectionChanged()
   self._updateColumnHeaders()