Python PyQt5.QtGui.QShowEvent() Examples

The following are 10 code examples of PyQt5.QtGui.QShowEvent(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtGui , or try the search function .
Example #1
Source File: mainwindow.py    From track with Apache License 2.0 11 votes vote down vote up
def event(self, e):
        if not isinstance(e, (
                QtCore.QEvent,
                QtCore.QChildEvent,
                QtCore.QDynamicPropertyChangeEvent,
                QtGui.QPaintEvent,
                QtGui.QHoverEvent,
                QtGui.QMoveEvent,
                QtGui.QEnterEvent,
                QtGui.QResizeEvent,
                QtGui.QShowEvent,
                QtGui.QPlatformSurfaceEvent,
                QtGui.QWindowStateChangeEvent,
                QtGui.QKeyEvent,
                QtGui.QWheelEvent,
                QtGui.QMouseEvent,
                QtGui.QFocusEvent,
                QtGui.QHelpEvent,
                QtGui.QHideEvent,
                QtGui.QCloseEvent,
                QtGui.QInputMethodQueryEvent,
                QtGui.QContextMenuEvent,
                )):
            log().warning("unknown event: %r %r", e.type(), e)
        return super().event(e) 
Example #2
Source File: clrapplier.py    From IDASkins with MIT License 6 votes vote down vote up
def eventFilter(self, obj, event):
        def is_colors_dialog():
            return isinstance(
                obj, QDialog) and 'IDA Colors' in obj.windowTitle()

        if isinstance(event, QShowEvent) and is_colors_dialog():
            qApp.removeEventFilter(self)

            # Hide window and find &Import button
            obj.windowHandle().setOpacity(0)
            buttons = [widget for widget in obj.children() if isinstance(
                widget, QDialogButtonBox)][0]
            button = [widget for widget in buttons.buttons() if widget.text()
                      == '&Import'][0]

            with NativeHook(ask_file=self.ask_file_handler):
                button.click()

            QTimer.singleShot(0, lambda: obj.accept())
            return 1
        return 0 
Example #3
Source File: mediainfo.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def showEvent(self, event: QShowEvent) -> None:
        if self.content.verticalScrollBar().isVisible() \
                and (self.parent.parent.parent.stylename == 'fusion' or sys.platform in {'win32', 'darwin'}):
            self.content.setStyleSheet('''
                QTextBrowser {{
                    border-left: none;
                    border-right: 1px solid {0};
                    border-top: 1px solid {0};
                    border-bottom: 1px solid {0};
                    background-color: transparent;
                }}'''.format('#4D5355' if self.parent.parent.theme == 'dark' else '#C0C2C3'))
        super(KeyframesDialog, self).showEvent(event) 
Example #4
Source File: settings.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def showEvent(self, event: QShowEvent) -> None:
        self.clearSpinners()
        super(GeneralPage, self).showEvent(event) 
Example #5
Source File: videoconsole.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def showEvent(self, event: QShowEvent):
        self.parent.consoleLogger.flush()
        super(ConsoleWidget, self).showEvent(event) 
Example #6
Source File: widgets.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def showEvent(self, event: QShowEvent):
            self.adjustSize()
            self.parent.adjustSize() 
Example #7
Source File: videocutter.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def showEvent(self, event: QShowEvent) -> None:
        if hasattr(self, 'filterProgressBar') and self.filterProgressBar.isVisible():
            self.filterProgressBar.update()
        super(VideoCutter, self).showEvent(event) 
Example #8
Source File: loading_dialog.py    From CvStudio with MIT License 5 votes vote down vote up
def showEvent(self, e: QShowEvent):
        if self.movie.state() == QMovie.NotRunning:
            self.movie.start() 
Example #9
Source File: dataframe_viewer.py    From pandasgui with MIT License 5 votes vote down vote up
def showEvent(self, event: QtGui.QShowEvent):
        """
        Initialize column and row sizes on the first time the widget is shown
        """
        if not self._loaded:
            # Set column widths
            for column_index in range(self.columnHeader.model().columnCount()):
                self.auto_size_column(column_index)

            # Set row heights
            # Just sets a single uniform row height based on the first N rows for performance.
            N = 100
            default_row_height = 30
            for row_index in range(self.indexHeader.model().rowCount())[:N]:
                self.auto_size_row(row_index)
                height = self.indexHeader.rowHeight(row_index)
                default_row_height = max(default_row_height, height)

            # Set limit for default row height
            default_row_height = min(default_row_height, 100)

            self.indexHeader.verticalHeader().setDefaultSectionSize(default_row_height)
            self.dataView.verticalHeader().setDefaultSectionSize(default_row_height)

        self._loaded = True
        event.accept() 
Example #10
Source File: filter.py    From IDArling with GNU General Public License v3.0 4 votes vote down vote up
def eventFilter(self, obj, ev):  # noqa: N802
        # Is it a QShowEvent on a QDialog named "Dialog"?
        if (
            ev.__class__ == ev,
            QShowEvent
            and obj.__class__ == QDialog
            and obj.windowTitle() == "About",
        ):
            # Find a child QGroupBox
            for groupBox in obj.children():
                if groupBox.__class__ == QGroupBox:
                    # Find a child QLabel with an icon
                    for label in groupBox.children():
                        if isinstance(label, QLabel) and label.pixmap():
                            self._replace_icon(label)

        # Is it a QContextMenuEvent on a QWidget?
        if isinstance(obj, QWidget) and isinstance(ev, QContextMenuEvent):
            # Find a parent titled "IDA View"
            parent = obj
            while parent:
                if parent.windowTitle().startswith("IDA View"):
                    # Intercept the next context menu
                    self._intercept = True
                parent = parent.parent()

        # Is it a QShowEvent on a QMenu?
        if isinstance(obj, QMenu) and isinstance(ev, QShowEvent):
            # Should we intercept?
            if self._intercept:
                self._insert_menu(obj)
                self._intercept = False

        # Is it a ToolTip event on a QWidget with a parent?
        if (
            ev.type() == QEvent.ToolTip
            and obj.__class__ == QWidget
            and obj.parent()
        ):
            table_view = obj.parent()
            # Is it a QTableView with a parent?
            if table_view.__class__ == QTableView and table_view.parent():
                func_window = table_view.parent()
                # Is it a QWidget titled "Functions window"?
                if (
                    func_window.__class__ == QWidget
                    and func_window.windowTitle() == "Functions window"
                ):
                    self._set_tooltip(obj, ev)

        return False