Exemplo n.º 1
0
 def show_msg_box(self, icon):
     msg = QtModernRedux.wrap(QMessageBox(self), parent=self, window_buttons_position=QtModernRedux.WINDOW_BUTTONS_RIGHT)
     msg.setIcon(icon)
     msg.setText("This is a message box")
     msg.setInformativeText("This is additional information")
     msg.setWindowTitle("MessageBox demo")
     msg.setDetailedText("The details are as follows:")
     retval = msg.exec_()
     print("value of pressed message box button:", retval)
Exemplo n.º 2
0
import sys
from PySide2.QtWidgets import QMainWindow
from qtmodernredux import QtModernRedux
from mainwindow_ui import Ui_MainWindow
"""
This example demonstrates all the styled widgets supported by QtModernRedux. 
"""

__author__ = "Robert Kist"


class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.__ui = Ui_MainWindow()
        self.__ui.setupUi(self)


if __name__ == "__main__":
    app = QtModernRedux.QApplication(sys.argv)
    mw = QtModernRedux.wrap(MainWindow())
    mw.show()
    sys.exit(app.exec_())
Exemplo n.º 3
0
    def show_information_msgbox(self):
        self.show_msg_box(QMessageBox.Information)

    def show_regular_msgbox(self):
        self.show_msg_box(QMessageBox.NoIcon)

    def show_msg_box(self, icon):
        msg = QtModernRedux.wrap(
            QMessageBox(self),
            parent=self,
            window_buttons_position=QtModernRedux.WINDOW_BUTTONS_RIGHT)
        msg.setIcon(icon)
        msg.setText("This is a message box")
        msg.setInformativeText("This is additional information")
        msg.setWindowTitle("MessageBox demo")
        msg.setDetailedText("The details are as follows:")
        retval = msg.exec_()
        print("value of pressed message box button:", retval)


if __name__ == "__main__":
    from wow_style import Style

    app = QtModernRedux.QApplication(sys.argv, style=Style)
    mw = QtModernRedux.wrap(
        MainWindow(),
        titlebar_height=40,
        window_buttons_position=QtModernRedux.WINDOW_BUTTONS_RIGHT)
    mw.show()
    sys.exit(app.exec_())
Exemplo n.º 4
0
    def showEvent(self, event) -> None:
        if sys.platform in ['linux', 'darwin']:
            media_content = QMediaContent(
                QUrl.fromLocalFile(
                    QFileInfo(
                        './../example_data/sample.mp4').absoluteFilePath()))
        else:
            media_content = QMediaContent(
                QUrl.fromLocalFile(
                    QFileInfo(
                        './../example_data/pusheen.gif').absoluteFilePath()))
        self.media_player.setMedia(media_content)
        self.media_player.setVideoOutput(self.video_widget)
        self.video_widget.show()
        self.video_widget.update()
        self.media_player.setPosition(0)
        self.media_player.play()


if __name__ == "__main__":
    app = QtModernRedux.QApplication(sys.argv)
    mw = QtModernRedux.wrap(
        MainWindow(),
        title_bar=True,
        transparent_window=False,
        window_buttons_position=QtModernRedux.WINDOW_BUTTONS_RIGHT)
    desktop = QApplication.desktop()
    mw.show()
    sys.exit(app.exec_())
Exemplo n.º 5
0

class MainWindow(QMainWindow):

    def __init__(self, parent=None):
        """Constructor"""
        super().__init__(parent)
        self.__ui = Ui_MainWindow()
        self.__ui.setupUi(self)
        self.__ui.tabWidget.setTabsClosable(True)
        self.__ui.tabWidget.setMovable(True)

    @property
    def tab_widget(self):
        """Expose the titlebar tab widget so it can be styled"""
        return self.__ui.tabWidget


if __name__ == "__main__":
    app = QtModernRedux.QApplication(sys.argv)
    main_window = MainWindow()
    modern_window = QtModernRedux.wrap(main_window,
                                       title_bar=False,
                                       titlebar_height=40,
                                       titlebar_color=QColor('#0076d2'),
                                       titlebar_nofocus_color=QColor('#ff0000'),
                                       titlebar_widget=main_window.tab_widget,
                                       window_buttons_position=QtModernRedux.WINDOW_BUTTONS_LEFT)
    modern_window.show()
    sys.exit(app.exec_())
Exemplo n.º 6
0
    def show_critical_msgbox(self):
        self.show_msg_box(QMessageBox.Critical)

    def show_question_msgbox(self):
        self.show_msg_box(QMessageBox.Question)

    def show_information_msgbox(self):
        self.show_msg_box(QMessageBox.Information)

    def show_regular_msgbox(self):
        self.show_msg_box(QMessageBox.NoIcon)

    def show_msg_box(self, icon):
        msg = QtModernRedux.wrap(QMessageBox(self), parent=self, window_buttons_position=QtModernRedux.WINDOW_BUTTONS_RIGHT)
        msg.setIcon(icon)
        msg.setText("This is a message box")
        msg.setInformativeText("This is additional information")
        msg.setWindowTitle("MessageBox demo")
        msg.setDetailedText("The details are as follows:")
        retval = msg.exec_()
        print("value of pressed message box button:", retval)


if __name__ == "__main__":
    app = QtModernRedux.QApplication(sys.argv)
    mw = QtModernRedux.wrap(MainWindow(),
                            window_buttons_position=QtModernRedux.WINDOW_BUTTONS_RIGHT)
    mw.setWindowIcon(QIcon("../example_data/sample.png"))
    mw.show()
    sys.exit(app.exec_())
Exemplo n.º 7
0

class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        """Constructor"""
        super().__init__(parent)
        self.__ui = Ui_MainWindow()
        self.__ui.setupUi(self)

    @property
    def title_widget(self):
        """Expose the titlebar widget so it can be styled"""
        return self.__ui.title_widget


if __name__ == "__main__":
    app = QtModernRedux.QApplication(sys.argv)
    main_window = MainWindow()
    modern_window = QtModernRedux.wrap(
        main_window,
        title_bar=False,  # disable standard titlebar
        titlebar_height=42,
        titlebar_color=QColor('#0076d2'),  # color when window is active
        titlebar_nofocus_color=QColor(
            '#555555'),  # color when window is in-active
        titlebar_widget=main_window.
        title_widget,  # widget to put into the titlebar
        window_buttons_position=QtModernRedux.WINDOW_BUTTONS_RIGHT)
    modern_window.show()
    sys.exit(app.exec_())