def _update_mac_app_info(): if sys.platform.startswith('darwin'): try: from Foundation import NSBundle # noqa bundle = NSBundle.mainBundle() if bundle: app_info = bundle.localizedInfoDictionary() or bundle.infoDictionary() if app_info: app_info['CFBundleName'] = extrap.__title__ from AppKit import NSWindow NSWindow.setAllowsAutomaticWindowTabbing_(False) except ImportError: pass
def __init__(self, parent): super(QMainWindow, self).__init__(parent) uic.loadUi('ui/mainWindow.ui', self) self.play_btn.clicked.connect(self.play_btn_clicked) self.stop_btn.clicked.connect(self.stop_btn_clicked) self.fullscreen_btn.clicked.connect(self.switch_fullscreen_mode) self.volume_slider.sliderMoved.connect(self.volume_changed) self.tv_channel_list.channelActivated.connect(self.activated_channel) self.radio_channel_list.channelActivated.connect( self.activated_channel) self.video_player.playback_started.connect(self.video_playback_started) self.video_player.playback_paused.connect(self.video_playback_paused) self.video_player.playback_stopped.connect(self.video_playback_stopped) self.video_player.playback_error.connect(self.video_playback_error) self.video_player.volume_changed.connect(self.video_volume_changed) self.video_player.chromecast_available.connect( self.chromecast_available) self.video_player.chromecast_connected.connect( self.chromecast_connected) self.chlist_manager = ChannelListManager() self.chlist_manager.channel_added.connect(self.channel_added) self.chlist_manager.channellist_available.connect( self.channel_list_available) self.statusbar.addPermanentWidget(self.bottom_bar, 1) self.splitter.setStretchFactor(1, 1) self.progress_bar.hide() self.progress_label.setText(self.tr("Idle")) self.video_player.set_volume(self.volume_slider.value()) self.channellist_show_actiongroup = QActionGroup(self) self.channellist_show_actiongroup.triggered.connect( self.show_channel_list) chlist_showall_action = QAction(self.tr("All"), self.menu_show_chlist) chlist_showall_action.setCheckable(True) chlist_showall_action.setChecked(True) chlist_showall_action.setActionGroup(self.channellist_show_actiongroup) self.menu_show_chlist.addAction(chlist_showall_action) os_type = platform.system() log.info('Detected OS type: {0}'.format(os_type)) if os_type == 'Darwin': from AppKit import NSWindow, NSUserDefaults NSWindow.setAllowsAutomaticWindowTabbing_(False) NSUserDefaults.standardUserDefaults().setBool_forKey_( False, "NSFullScreenMenuItemEverywhere") self.playlist_tab_widget.setDocumentMode(True) channel_list_action = self.menubar.actions()[0].menu().actions()[0] preferences_list_action = self.menubar.actions()[0].menu().actions( )[1] self.menubar.removeAction(self.menubar.actions()[0]) channel_list_action.menu().addAction(preferences_list_action) self.menubar.insertAction(self.menubar.actions()[0], channel_list_action) self.load_settings() # Set custom icons self.play_btn.setIcon(TXIcon('icons/play-button.svg')) self.stop_btn.setIcon(TXIcon('icons/stop-button.svg')) self.fullscreen_btn.setIcon(TXIcon('icons/fullscreen.svg')) self.cast_btn.setIcon(TXIcon('icons/cast.svg')) self.cast_label_pixmap.setHidden(True) self.cast_label.setHidden(True) self.cast_btn.hide()