def __init__(self): super(Controller, self).__init__() self.playlist = Playlist(sys.argv[1:]) self.subtitles = Subtitles() self.signal = Signal() self.gui = GuiMain(self) self.gui.update_menu(self.main_menu) self.player = Player.create('gstreamer', self.gui, self.gui.movie_window.winId()) self.commands = Commands(self) settings.get_path('data', 'mainicon.png') self.view = {}
def _load_theme(self): pos_data = utils.File(settings.get_path('themes', settings.get('gui.theme'), 'controls.txt')).read() self._pos = {} for line in pos_data.splitlines(): parts = line.split() if parts and not parts[0].startswith('#'): self._pos[parts[0]] = (int(parts[1]), int(parts[2])) if '_' in self._pos: self._pos[' '] = tuple(self._pos['_']) assert self._pos['['][1] == self._pos[']'][1] assert self._pos['['][1] == self._pos['{'][1] assert self._pos[']'][1] == self._pos['}'][1] self.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)) self._pixmap = QPixmap(settings.get_path('themes', settings.get('gui.theme'), 'controls.png'))
def _get_icon(self, dir, name): if (dir, name) in self.icons: return self.icons[(dir, name)] else: path = settings.get_path('icons', dir, name + '.png') pixmap = QPixmap(path) if pixmap.isNull(): result = QVariant() else: result = QVariant(pixmap) self.icons[(dir, name)] = result return result
def __getitem__(self, key): if key not in self._data: if key in self._keys: filename = self._keys[key] else: filename = 'cache.db' path = settings.get_path('~', 'cache', self._hash, 'cover.jpg') result = None if utils.File(info_path_img).exists(): data = utils.File(path).read() else: if key in self._keys: result = '' else: result = {} self._data[key] = result return self._data[key]
def __init__(self, controller=None): QApplication.__init__(self, sys.argv) self.controller = controller self.setWindowIcon(QIcon(settings.get_path('data', 'mainicon.png'))) self.window = GuiMainWindow(self.controller) # work - only on systems with support of this #self.window.setWindowOpacity(0.5) self.central = QWidget() self.window.setCentralWidget(self.central) #self.window = QMainWindow() self.window.setWindowTitle("Lily Player") self.central.setLayout(QVBoxLayout()) self.central.layout().setMargin(0) self.central.layout().setSpacing(0) self.connect(self.window, SIGNAL('myKey(QString)'), self.key) self.entry = QLineEdit(self.window) self.central.layout().addWidget(self.entry) self.connect(self.entry, SIGNAL("returnPressed()"), self.run) self.entry.setVisible(False) self.movie_window = GuiMovieWindow(self.window, self.controller) self.markup_window = GuiMarkupWindow(self.movie_window) self.markup_window.set_style({'font-size': 32, 'border-width': 1}) self.markup_window.render('Ala ma kota<br/>i psa', {'font-size': '32'}) self.markup_window.setParent(self.movie_window, Qt.Tool) self.markup_window.show() logging.debug('markup_window.show()') self.sidebar = GuiSidebar(self.window, controller) self.splitter = QSplitter(Qt.Horizontal) self.splitter.addWidget(self.movie_window) self.splitter.addWidget(self.sidebar) self.central.layout().addWidget(self.splitter) self.controls = PlayControls(self.window, self.controller) self.central.layout().addWidget(self.controls) self.window.setAcceptDrops(True) self.window.resize(self.window.minimumSizeHint().expandedTo(QSize(600, 400))) self.window.show() QTimer.singleShot(0, self.autoopen) self.markup_timer = QTimer() self.markup_timer.start(200) QObject.connect(self.markup_timer, SIGNAL("timeout()"), self.on_markup_timer)