class MainWindowMixin(object): # {{{ def __init__(self, *args, **kwargs): pass def init_main_window_mixin(self, db): self.setObjectName('MainWindow') self.setWindowIcon(QIcon(I('lt.png'))) self.setWindowTitle(__appname__) self.setContextMenuPolicy(Qt.NoContextMenu) self.centralwidget = QWidget(self) self.setCentralWidget(self.centralwidget) self._central_widget_layout = QVBoxLayout() self.centralwidget.setLayout(self._central_widget_layout) self.resize(1012, 740) self.donate_button = ThrobbingButton() self.location_manager = LocationManager(self) self.iactions['Fetch News'].init_scheduler(db) self.search_bar = SearchBar(self) self.bars_manager = BarsManager(self.donate_button, self.location_manager, self) for bar in self.bars_manager.main_bars: self.addToolBar(Qt.TopToolBarArea, bar) for bar in self.bars_manager.child_bars: self.addToolBar(Qt.BottomToolBarArea, bar) self.bars_manager.update_bars() # This is disabled because it introduces various toolbar related bugs # The width of the toolbar becomes the sum of both toolbars if tweaks['unified_title_toolbar_on_osx']: self.setUnifiedTitleAndToolBarOnMac(True) l = self.centralwidget.layout() l.addWidget(self.search_bar)
class MainWindowMixin(object): # {{{ def __init__(self, db): self.setObjectName('MainWindow') self.setWindowIcon(QIcon(I('lt.png'))) self.setWindowTitle(__appname__) self.setContextMenuPolicy(Qt.NoContextMenu) self.centralwidget = QWidget(self) self.setCentralWidget(self.centralwidget) self._central_widget_layout = QVBoxLayout() self.centralwidget.setLayout(self._central_widget_layout) self.resize(1012, 740) self.donate_button = ThrobbingButton() self.location_manager = LocationManager(self) self.iactions['Fetch News'].init_scheduler(db) self.search_bar = SearchBar(self) self.bars_manager = BarsManager(self.donate_button, self.location_manager, self) for bar in self.bars_manager.main_bars: self.addToolBar(Qt.TopToolBarArea, bar) for bar in self.bars_manager.child_bars: self.addToolBar(Qt.BottomToolBarArea, bar) self.bars_manager.update_bars() # This is disabled because it introduces various toolbar related bugs # The width of the toolbar becomes the sum of both toolbars if tweaks['unified_title_toolbar_on_osx']: self.setUnifiedTitleAndToolBarOnMac(True) l = self.centralwidget.layout() l.addWidget(self.search_bar)
class MainWindowMixin(object): # {{{ def __init__(self, *args, **kwargs): pass def init_main_window_mixin(self, db): self.setObjectName('MainWindow') self.setWindowIcon(QIcon(I('lt.png'))) self.setWindowTitle(__appname__) self.setContextMenuPolicy(Qt.NoContextMenu) self.centralwidget = QWidget(self) self.setCentralWidget(self.centralwidget) self._central_widget_layout = l = QVBoxLayout(self.centralwidget) l.setContentsMargins(0, 0, 0, 0) l.setSpacing(0) self.resize(1012, 740) self.location_manager = LocationManager(self) self.iactions['Fetch News'].init_scheduler(db) self.search_bar = SearchBar(self) self.bars_manager = BarsManager(self.donate_action, self.location_manager, self) for bar in self.bars_manager.main_bars: self.addToolBar(Qt.TopToolBarArea, bar) bar.setStyleSheet('QToolBar { border: 0px }') for bar in self.bars_manager.child_bars: self.addToolBar(Qt.BottomToolBarArea, bar) bar.setStyleSheet('QToolBar { border: 0px }') self.bars_manager.update_bars() # This is disabled because it introduces various toolbar related bugs # The width of the toolbar becomes the sum of both toolbars if tweaks['unified_title_toolbar_on_osx']: try: self.setUnifiedTitleAndToolBarOnMac(True) except AttributeError: pass # PyQt5 seems to be missing this property # And now, start adding the real widgets l.addWidget(self.search_bar) # Add in the widget for the shutdown messages. It is invisible until a # message is shown smw = self.shutdown_message_widget = QLabel(self) smw.setAlignment(Qt.AlignCenter) smw.setVisible(False) smw.setAutoFillBackground(True) smw.setStyleSheet( 'QLabel { background-color: rgba(200, 200, 200, 200); color: black }' ) def show_shutdown_message(self, message=''): smw = self.shutdown_message_widget smw.setGeometry(0, 0, self.width(), self.height()) smw.setVisible(True) smw.raise_() smw.setText(_('<h2>Shutting down</h2><div>') + message) # Force processing the events needed to show the message QCoreApplication.processEvents()
class MainWindowMixin(object): # {{{ def __init__(self, *args, **kwargs): pass def init_main_window_mixin(self, db): self.setObjectName('MainWindow') self.setWindowIcon(QIcon(I('lt.png'))) self.setWindowTitle(__appname__) self.setContextMenuPolicy(Qt.NoContextMenu) self.centralwidget = QWidget(self) self.setCentralWidget(self.centralwidget) self._central_widget_layout = QVBoxLayout() self.centralwidget.setLayout(self._central_widget_layout) self.resize(1012, 740) self.donate_button = ThrobbingButton() self.location_manager = LocationManager(self) self.iactions['Fetch News'].init_scheduler(db) self.search_bar = SearchBar(self) self.bars_manager = BarsManager(self.donate_button, self.location_manager, self) for bar in self.bars_manager.main_bars: self.addToolBar(Qt.TopToolBarArea, bar) for bar in self.bars_manager.child_bars: self.addToolBar(Qt.BottomToolBarArea, bar) self.bars_manager.update_bars() # This is disabled because it introduces various toolbar related bugs # The width of the toolbar becomes the sum of both toolbars if tweaks['unified_title_toolbar_on_osx']: try: self.setUnifiedTitleAndToolBarOnMac(True) except AttributeError: pass # PyQt5 seems to be missing this property l = self.centralwidget.layout() # Add in the widget for the shutdown messages. It is invisible until a # message is shown smw = self.shutdown_message_widget = QLabel('') smw.setMinimumHeight(200) smw.setAlignment(Qt.AlignCenter) self.shutdown_message_widget.setVisible(False) l.addWidget(smw) # And now, start adding the real widgets l.addWidget(self.search_bar) def show_shutdown_message(self, message): smw = self.shutdown_message_widget smw.setVisible(True) txt = smw.text() txt += '\n' + message smw.setText(txt) # Force processing the events needed to show the message QCoreApplication.processEvents()
class MainWindowMixin(object): # {{{ def __init__(self, *args, **kwargs): pass def init_main_window_mixin(self, db): self.setObjectName('MainWindow') self.setWindowIcon(QIcon(I('lt.png'))) self.setWindowTitle(__appname__) self.setContextMenuPolicy(Qt.NoContextMenu) self.centralwidget = QWidget(self) self.setCentralWidget(self.centralwidget) self._central_widget_layout = l = QVBoxLayout(self.centralwidget) l.setContentsMargins(0, 0, 0, 0) l.setSpacing(0) self.resize(1012, 740) self.location_manager = LocationManager(self) self.iactions['Fetch News'].init_scheduler(db) self.search_bar = SearchBar(self) self.bars_manager = BarsManager(self.donate_action, self.location_manager, self) for bar in self.bars_manager.main_bars: self.addToolBar(Qt.TopToolBarArea, bar) bar.setStyleSheet('QToolBar { border: 0px }') for bar in self.bars_manager.child_bars: self.addToolBar(Qt.BottomToolBarArea, bar) bar.setStyleSheet('QToolBar { border: 0px }') self.bars_manager.update_bars() # This is disabled because it introduces various toolbar related bugs # The width of the toolbar becomes the sum of both toolbars if tweaks['unified_title_toolbar_on_osx']: try: self.setUnifiedTitleAndToolBarOnMac(True) except AttributeError: pass # PyQt5 seems to be missing this property # And now, start adding the real widgets l.addWidget(self.search_bar) # Add in the widget for the shutdown messages. It is invisible until a # message is shown smw = self.shutdown_message_widget = QLabel(self) smw.setAlignment(Qt.AlignCenter) smw.setVisible(False) smw.setAutoFillBackground(True) smw.setStyleSheet('QLabel { background-color: rgba(200, 200, 200, 200); color: black }') def show_shutdown_message(self, message=''): smw = self.shutdown_message_widget smw.setGeometry(0, 0, self.width(), self.height()) smw.setVisible(True) smw.raise_() smw.setText(_('<h2>Shutting down</h2><div>') + message) # Force processing the events needed to show the message QCoreApplication.processEvents()