Python PyQt5.QtCore.Qt.Window() Examples

The following are 29 code examples of PyQt5.QtCore.Qt.Window(). 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.QtCore.Qt , or try the search function .
Example #1
Source File: FilterBandwidthDialog.py    From urh with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogFilterBandwidth()
        self.ui.setupUi(self)
        self.setWindowFlags(Qt.Window)

        bw_type = settings.read("bandpass_filter_bw_type", "Medium", str)
        custom_bw = settings.read("bandpass_filter_custom_bw", 0.1, float)

        for item in dir(self.ui):
            item = getattr(self.ui, item)
            if isinstance(item, QLabel):
                name = item.objectName().replace("label", "")
                key = next((key for key in Filter.BANDWIDTHS.keys() if name.startswith(key.replace(" ", ""))), None)
                if key is not None and name.endswith("Bandwidth"):
                    item.setText("{0:n}".format(Filter.BANDWIDTHS[key]))
                elif key is not None and name.endswith("KernelLength"):
                    item.setText(str(Filter.get_filter_length_from_bandwidth(Filter.BANDWIDTHS[key])))
            elif isinstance(item, QRadioButton):
                item.setChecked(bw_type.replace(" ", "_") == item.objectName().replace("radioButton", ""))

        self.ui.doubleSpinBoxCustomBandwidth.setValue(custom_bw)
        self.ui.spinBoxCustomKernelLength.setValue(Filter.get_filter_length_from_bandwidth(custom_bw))

        self.create_connects() 
Example #2
Source File: visualizarImprimirExportar.py    From PyQt5 with MIT License 6 votes vote down vote up
def vistaPrevia(self):
        if not self.documento.isEmpty():
            impresion = QPrinter(QPrinter.HighResolution)
            
            vista = QPrintPreviewDialog(impresion, self)
            vista.setWindowTitle("Vista previa")
            vista.setWindowFlags(Qt.Window)
            vista.resize(800, 600)

            exportarPDF = vista.findChildren(QToolBar)
            exportarPDF[0].addAction(QIcon("exportarPDF.png"), "Exportar a PDF", self.exportarPDF)
            
            vista.paintRequested.connect(self.vistaPreviaImpresion)
            vista.exec_()
        else:
            QMessageBox.critical(self, "Vista previa", "No hay datos para visualizar.   ",
                                 QMessageBox.Ok) 
Example #3
Source File: CSVImportDialog.py    From urh with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, filename="", parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogCSVImport()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowFlags(Qt.Window)

        self.ui.btnAutoDefault.hide()

        completer = QCompleter()
        completer.setModel(QDirModel(completer))
        self.ui.lineEditFilename.setCompleter(completer)

        self.filename = None  # type: str
        self.ui.lineEditFilename.setText(filename)
        self.update_file()

        self.ui.tableWidgetPreview.setColumnHidden(self.COLUMNS["T"], True)
        self.update_preview()

        self.create_connects() 
Example #4
Source File: NativeEvent.py    From PyQt with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        # 主屏幕的可用大小(去掉任务栏)
        self._rect = QApplication.instance().desktop().availableGeometry(self)
        self.resize(800, 600)
        self.setWindowFlags(Qt.Window
                            | Qt.FramelessWindowHint
                            | Qt.WindowSystemMenuHint
                            | Qt.WindowMinimizeButtonHint
                            | Qt.WindowMaximizeButtonHint
                            | Qt.WindowCloseButtonHint)
        # 增加薄边框
        style = win32gui.GetWindowLong(int(self.winId()), win32con.GWL_STYLE)
        win32gui.SetWindowLong(
            int(self.winId()), win32con.GWL_STYLE, style | win32con.WS_THICKFRAME)

        if QtWin.isCompositionEnabled():
            # 加上 Aero 边框阴影
            QtWin.extendFrameIntoClientArea(self, -1, -1, -1, -1)
        else:
            QtWin.resetExtendedFrame(self) 
Example #5
Source File: exceptwindow.py    From Pythonic with GNU General Public License v3.0 6 votes vote down vote up
def initUI(self):

        self.confirm_button = QPushButton()

        self.headline = QFont("Arial", 10, QFont.Bold)

        self.elementInfo = QLabel()
        self.elementInfo.setFont(self.headline)

        self.exceptionMessage = QTextEdit()
        self.exceptionMessage.setReadOnly(True)

        self.setMinimumSize(400, 300)
        self.setWindowFlags(Qt.Window)

        self.exceptWindowLayout = QVBoxLayout()
        self.exceptWindowLayout.addWidget(self.elementInfo)
        self.exceptWindowLayout.addWidget(self.exceptionMessage)
        self.exceptWindowLayout.addStretch(1)
        self.exceptWindowLayout.addWidget(self.confirm_button)

        self.confirm_button.clicked.connect(self.close)

        self.setLayout(self.exceptWindowLayout) 
Example #6
Source File: basic_stack_window.py    From Pythonic with GNU General Public License v3.0 5 votes vote down vote up
def raiseWindow(self, filename):

        logging.debug('StackWindow() called')
        self.setMinimumSize(400, 300)
        self.setWindowFlags(Qt.Window)
        self.setWindowTitle(QC.translate('', 'Stack'))

        self.confirm_button = QPushButton()
        self.confirm_button.setText(QC.translate('', 'Ok'))
        self.confirm_button.clicked.connect(self.close)

        self.headline = QFont("Arial", 10, QFont.Bold)

        self.info_string = QC.translate('', 'Debug info of element:')
        self.elementInfo = QLabel()
        self.elementInfo.setFont(self.headline)
        self.elementInfoText = QC.translate('', 'Last update:')
        self.elementInfoText += ' {}'.format(self.timestamp)
        self.elementInfo.setText(self.elementInfoText)

        # Will contain the QListWidgetItems
        self.stackWidget = QListWidget()

        try:
            self.restock(filename)
        except Exception as e:
            logging.error('StackWindow::raiseWindow() exception while opening file: {}'.format(e))
            self.closed.emit()
            return

               
        self.debugWindowLayout = QVBoxLayout()
        self.debugWindowLayout.addWidget(self.elementInfo)
        self.debugWindowLayout.addWidget(self.stackWidget)
        self.debugWindowLayout.addWidget(self.confirm_button)

        self.setLayout(self.debugWindowLayout)   
        
        self.show() 
Example #7
Source File: download_window.py    From Artemis with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        """Initialize the window."""
        super().__init__()
        self.setupUi(self)
        self.setWindowFlags(
            # Qt.Window                |
            Qt.CustomizeWindowHint   |
            Qt.WindowTitleHint       |
            Qt.WindowCloseButtonHint |
            Qt.WindowStaysOnTopHint
        )

        self._no_internet_msg = pop_up(self, title=Messages.NO_CONNECTION,
                                       text=Messages.NO_CONNECTION_MSG,
                                       connection=self.close)

        self._bad_db_download_msg = pop_up(self, title=Messages.BAD_DOWNLOAD,
                                           text=Messages.BAD_DOWNLOAD_MSG,
                                           connection=self.close)

        self._slow_conn_msg = pop_up(self, title=Messages.SLOW_CONN,
                                     text=Messages.SLOW_CONN_MSG,
                                     connection=self.close)

        self._download_thread = DownloadThread()
        self._download_thread.finished.connect(self._wait_close)
        self._download_thread.progress.connect(self._display_progress)
        self._download_thread.speed_progress.connect(self._display_speed)
        self.closed.connect(self._download_thread.set_exit)
        self.cancel_btn.clicked.connect(self._terminate_process)
        self._size = 0
        self.target = None 
Example #8
Source File: SendRecvDialog.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, project_manager: ProjectManager, is_tx: bool, continuous_send_mode=False, parent=None, testing_mode=False):
        super().__init__(parent)
        self.is_tx = is_tx
        self.update_interval = 25

        # This flag is needed. Will cause memory leak otherwise.
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.setWindowFlags(Qt.Window)
        self.testing_mode = testing_mode

        self.ui = Ui_SendRecvDialog()
        self.ui.setupUi(self)
        util.set_splitter_stylesheet(self.ui.splitter)

        self.ui.txtEditErrors.setFont(util.get_monospace_font())

        self.graphics_view = None  # type: QGraphicsView

        self.backend_handler = BackendHandler()

        self.ui.btnStop.setEnabled(False)
        self.ui.btnSave.setEnabled(False)

        self.start = 0

        self.device_settings_widget = DeviceSettingsWidget(project_manager, is_tx,
                                                           backend_handler=self.backend_handler,
                                                           continuous_send_mode=continuous_send_mode)
        self.ui.scrollAreaWidgetContents_2.layout().insertWidget(0, self.device_settings_widget)

        if testing_mode:
            self.device_settings_widget.ui.cbDevice.setCurrentText(NetworkSDRInterfacePlugin.NETWORK_SDR_NAME)

        self.timer = QTimer(self)
        self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes))

        self.ui.splitter.setSizes([int(0.4 * self.width()), int(0.6 * self.width())]) 
Example #9
Source File: FuzzingDialog.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, protocol: ProtocolAnalyzerContainer, label_index: int, msg_index: int, proto_view: int,
                 parent=None):
        super().__init__(parent)
        self.ui = Ui_FuzzingDialog()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowFlags(Qt.Window)

        self.protocol = protocol
        msg_index = msg_index if msg_index != -1 else 0
        self.ui.spinBoxFuzzMessage.setValue(msg_index + 1)
        self.ui.spinBoxFuzzMessage.setMinimum(1)
        self.ui.spinBoxFuzzMessage.setMaximum(self.protocol.num_messages)

        self.ui.comboBoxFuzzingLabel.addItems([l.name for l in self.message.message_type])
        self.ui.comboBoxFuzzingLabel.setCurrentIndex(label_index)

        self.proto_view = proto_view
        self.fuzz_table_model = FuzzingTableModel(self.current_label, proto_view)
        self.fuzz_table_model.remove_duplicates = self.ui.chkBRemoveDuplicates.isChecked()
        self.ui.tblFuzzingValues.setModel(self.fuzz_table_model)
        self.fuzz_table_model.update()

        self.ui.spinBoxFuzzingStart.setValue(self.current_label_start + 1)
        self.ui.spinBoxFuzzingEnd.setValue(self.current_label_end)
        self.ui.spinBoxFuzzingStart.setMaximum(len(self.message_data))
        self.ui.spinBoxFuzzingEnd.setMaximum(len(self.message_data))

        self.update_message_data_string()
        self.ui.tblFuzzingValues.resize_me()

        self.create_connects()
        self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) 
Example #10
Source File: ModulationParametersDialog.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parameters: list, modulation_type: str, parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogModulationParameters()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowFlags(Qt.Window)

        self.parameters = parameters
        self.num_bits = int(math.log2(len(parameters)))

        if "FSK" in modulation_type:
            self.ui.tblSymbolParameters.setItemDelegateForColumn(1, KillerSpinBoxDelegate(-1e12, 1e12, self))
            self.ui.tblSymbolParameters.horizontalHeaderItem(1).setText("Frequency in Hz")
        elif "ASK" in modulation_type:
            self.ui.tblSymbolParameters.horizontalHeaderItem(1).setText("Amplitude")
            self.ui.tblSymbolParameters.setItemDelegateForColumn(1, SpinBoxDelegate(0, 100, self, "%"))
        elif "PSK" in modulation_type:
            self.ui.tblSymbolParameters.setItemDelegateForColumn(1, SpinBoxDelegate(-360, 360, self, "°"))
            self.ui.tblSymbolParameters.horizontalHeaderItem(1).setText("Phase")

        fmt = "{0:0" + str(self.num_bits) + "b}"
        self.ui.tblSymbolParameters.setRowCount(len(parameters))
        for i, parameter in enumerate(parameters):
            item = QTableWidgetItem(fmt.format(i))
            font = item.font()
            font.setBold(True)
            item.setFont(font)
            item.setFlags(Qt.ItemIsEnabled)
            self.ui.tblSymbolParameters.setItem(i, 0, item)

            item = QTableWidgetItem()
            item.setData(Qt.DisplayRole, self.parameters[i])
            self.ui.tblSymbolParameters.setItem(i, 1, item)
            self.ui.tblSymbolParameters.openPersistentEditor(self.ui.tblSymbolParameters.item(i, 1))

        self.create_connects() 
Example #11
Source File: MessageTypeDialog.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, message_type: MessageType, parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogMessageType()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowFlags(Qt.Window)

        operator_descriptions = list(OPERATION_DESCRIPTION.values())
        operator_descriptions.sort()

        self.setWindowTitle(self.tr("Rules for {}".format(message_type.name)))
        self.message_type = message_type
        self.original_ruleset = copy.deepcopy(message_type.ruleset)
        self.original_assigned_status = message_type.assigned_by_ruleset
        self.ruleset_table_model = RulesetTableModel(message_type.ruleset, operator_descriptions, parent=self)
        self.ui.tblViewRuleset.setModel(self.ruleset_table_model)

        self.ui.btnRemoveRule.setEnabled(len(message_type.ruleset) > 0)
        self.set_ruleset_ui_status()

        self.ui.rbAssignAutomatically.setChecked(self.message_type.assigned_by_ruleset)
        self.ui.rbAssignManually.setChecked(self.message_type.assign_manually)

        self.ui.tblViewRuleset.setItemDelegateForColumn(2, ComboBoxDelegate(["Bit", "Hex", "ASCII"], parent=self))
        self.ui.tblViewRuleset.setItemDelegateForColumn(3, ComboBoxDelegate(operator_descriptions, parent=self))

        for i in range(len(message_type.ruleset)):
            self.open_editors(i)

        self.ui.cbRulesetMode.setCurrentIndex(self.message_type.ruleset.mode.value)

        self.create_connects()
        self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) 
Example #12
Source File: FilterDialog.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, dsp_filter: Filter, parent=None):
        super().__init__(parent)
        self.ui = Ui_FilterDialog()
        self.ui.setupUi(self)
        self.setWindowFlags(Qt.Window)

        self.error_message = ""

        self.set_dsp_filter_status(dsp_filter.filter_type)
        self.create_connects() 
Example #13
Source File: return.py    From Pythonic with GNU General Public License v3.0 5 votes vote down vote up
def edit(self):
        logging.debug('edit() called ExecBranch')
        self.branchEditLayout = QVBoxLayout()

        self.branchEdit = QWidget(self)
        self.branchEdit.setMinimumSize(500, 400)
        self.branchEdit.setWindowFlags(Qt.Window)
        self.branchEdit.setWindowModality(Qt.WindowModal)
        self.branchEdit.setWindowTitle('Edit Branch')


        self.selectCondition = QComboBox()
        self.selectCondition.addItem('Greater than (>) ...', QVariant('>'))
        self.selectCondition.addItem('Greater or equal than (>=) ...', QVariant('>='))
        self.selectCondition.addItem('Less than (<) ...', QVariant('<'))
        self.selectCondition.addItem('Less or equal than (<=) ...', QVariant('<='))
        self.selectCondition.addItem('equal to (==) ...', QVariant('=='))
        self.selectCondition.addItem('NOT equal to (!=) ...', QVariant('!='))

        self.checkNegate = QCheckBox('Negate query (if NOT ... )')
        self.checkNegate.stateChanged.connect(self.negate_changed)
        self.if_text_1 = QLabel()
        self.if_text_1.setText('if INPUT is ...')

        self.branchEditLayout.addWidget(self.checkNegate)
        self.branchEditLayout.addWidget(self.if_text_1)
        self.branchEditLayout.addWidget(self.selectCondition)
        self.branchEditLayout.addStretch(1)
        self.branchEdit.setLayout(self.branchEditLayout)
        self.branchEdit.show() 
Example #14
Source File: terminal_dialog.py    From uPyLoader with MIT License 5 votes vote down vote up
def __init__(self, parent, connection, terminal):
        super(TerminalDialog, self).__init__(None, Qt.WindowCloseButtonHint)
        self.setupUi(self)

        self.setWindowFlags(Qt.Window)
        geometry = Settings().retrieve_geometry("terminal")
        if geometry:
            self.restoreGeometry(geometry)

        self.connection = connection
        self.terminal = terminal
        self._auto_scroll = True  # TODO: Settings?
        self.terminal_listener = Listener(self.emit_update_content)
        self._update_content_signal.connect(self.update_content)
        self.terminal.add_event.connect(self.terminal_listener)

        self.outputTextEdit.installEventFilter(self)
        self.outputTextEdit.verticalScrollBar().sliderPressed.connect(self._stop_scrolling)
        self.outputTextEdit.verticalScrollBar().sliderReleased.connect(self._scroll_released)
        self.outputTextEdit.verticalScrollBar().installEventFilter(self)
        self.inputTextBox.installEventFilter(self)
        self.clearButton.clicked.connect(self.clear_content)
        self.sendButton.clicked.connect(self.send_input)

        self.ctrlaButton.clicked.connect(lambda: self.send_control("a"))
        self.ctrlbButton.clicked.connect(lambda: self.send_control("b"))
        self.ctrlcButton.clicked.connect(lambda: self.send_control("c"))
        self.ctrldButton.clicked.connect(lambda: self.send_control("d"))
        self.ctrleButton.clicked.connect(lambda: self.send_control("e"))

        fixed_font = QFontDatabase.systemFont(QFontDatabase.FixedFont)
        self.outputTextEdit.setFont(fixed_font)
        self.inputTextBox.setFont(fixed_font)
        self.autoscrollCheckBox.setChecked(self._auto_scroll)
        self.autoscrollCheckBox.stateChanged.connect(self._auto_scroll_changed)

        self.terminal.read()
        self.outputTextEdit.setText(TerminalDialog.process_backspaces(self.terminal.history))
        self._input_history_index = 0 
Example #15
Source File: elementeditor.py    From Pythonic with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent):
        super().__init__(parent)
        self.setMinimumSize(400, 500)
        self.setWindowFlags(Qt.Window)
        self.setWindowModality(Qt.WindowModal)
        self.setAttribute(Qt.WA_DeleteOnClose, True)

        logging.debug('ElementEditor::__init__() called') 
Example #16
Source File: exceptwindow.py    From Pythonic with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, message, position):

        super().__init__()
        self.setMinimumSize(400, 300)
        self.setWindowFlags(Qt.Window)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
        self.message = message
        self.position = position
        self.initUI()
        self.raiseWindow() 
Example #17
Source File: Widgets.py    From Jade-Application-Kit with GNU General Public License v3.0 5 votes vote down vote up
def set_window_to_defaults(self):
        self.window_original_position.moveCenter(self.center)
        self.move(self.window_original_position.topLeft())
        self.resize(self.default_size("width"), self.default_size("height"))
        self.hide_show_bar()
        self.setWindowFlags(Qt.Window)
        self.show() 
Example #18
Source File: Widgets.py    From Jade-Application-Kit with GNU General Public License v3.0 5 votes vote down vote up
def set_window_to_defaults(self):
        self.window_original_position.moveCenter(self.center)
        self.move(self.window_original_position.topLeft())
        self.resize(self.default_size("width"), self.default_size("height"))
        self.hide_show_bar()
        self.setWindowFlags(Qt.Window)
        self.show() 
Example #19
Source File: notifications.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, icon: str, parent=None):
        super(Notification, self).__init__(parent)
        self.parent = parent
        self.theme = self.parent.theme
        self.setObjectName('notification')
        self.setContentsMargins(10, 10, 10, 10)
        self.setModal(True)
        self.setWindowFlags(Qt.Window | Qt.Dialog | Qt.FramelessWindowHint)
        self.setMinimumWidth(550)
        self.shown.connect(lambda: QTimer.singleShot(self.duration * 1000, self.close))
        self._title, self._message = '', ''
        self.buttons = []
        self.msgLabel = QLabel(self._message, self)
        self.msgLabel.setWordWrap(True)
        logo_label = QLabel('<img src="{}" width="82" />'.format(icon), self)
        logo_label.setFixedSize(82, 82)
        self.left_layout = QVBoxLayout()
        self.left_layout.addWidget(logo_label)
        layout = QHBoxLayout()
        layout.addStretch(1)
        layout.addLayout(self.left_layout)
        layout.addSpacing(10)
        layout.addWidget(self.msgLabel, Qt.AlignVCenter)
        layout.addStretch(1)
        self.setLayout(layout) 
Example #20
Source File: selector.py    From Anki-Night-Mode with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, disabled_stylers: set, all_stylers, title=_('Choose what to style'), on_update=None):
        super().__init__(self, parent, Qt.Window)
        self.on_update = on_update
        self.disabled_stylers = disabled_stylers
        self.all_stylers = all_stylers

        self.stylers_checkboxes = []
        self.stylers_layout = None
        self.init_ui(title) 
Example #21
Source File: color_map.py    From Anki-Night-Mode with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, color_map, title='Customise colors swapping', on_update=None):
        super().__init__(self, parent, Qt.Window)
        self.on_update = on_update
        self.color_map = color_map

        self.init_ui(title) 
Example #22
Source File: mode.py    From Anki-Night-Mode with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, settings, title='Manage Night Mode', on_update=lambda x: x):
        super().__init__(self, parent, Qt.Window)
        self.on_update = on_update
        self.settings = settings

        self.init_ui(title) 
Example #23
Source File: Widgets.py    From Jade-Application-Kit with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent, menus):

        super(Menu, self).__init__(parent)
        if menus:
            for menu in menus:
                if type(menu) is dict:
                    title = self.addMenu(menu["title"])
                    for entry in menu["entries"]:
                        submenu = QAction(entry[0], self)
                        title.addAction(submenu)
                        print(entry[1])
                        submenu.triggered.connect(self._on_click(entry[1]))

        help_menu = {"title": "Keyboard Shortcuts", "text": """
                <body style='margin-right:46px;'><b>
                    F11 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Toggle Full Screen 
                <br>
                    F10 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Toggle Corner Window
                <br>
                    CTRL + &nbsp; &nbsp; Zoom In  
                <br>
                    CTRL - &nbsp; &nbsp;  Zoom Out  
                </body>
        """},\
        {"title": "About JAK", "text": """
                <body style='margin-right:46px;'>
                <small>
                    This online application is copyright and ownership of their respective authors.
                    <br><br>
                    This wrapper offers the ability to run web applications, as a self contained native desktop application.
                    Enjoy.
                </small>
                <br>
                <center>
                <b><small>
                    Powered by:
                </b></small>
                <a href='https://github.com/codesardine/Jade-Application-Kit'>Jade Application Kit</a><center>
                <small>
                Native Hybrid Apps on Linux.
                <br>
                    <b>
                        Using QT WebEngine
                    <b>
                </small>
                <br>
                <small>
                    <br>
                        This application comes with no warranty. License: <b>GPL</b>
                    <br>
                        Author:<b>Vitor Lopes<b>
                </small>
                </center>
                </body>
        """}

        help = self.addMenu("Help")
        for entry in help_menu:
            submenu = QAction(entry["title"], self)
            submenu.triggered.connect(self._on_click(entry["text"], entry["title"]))
            help.addAction(submenu) 
Example #24
Source File: NativeEvent.py    From PyQt with GNU General Public License v3.0 4 votes vote down vote up
def nativeEvent(self, eventType, message):
        retval, result = super(Window, self).nativeEvent(eventType, message)
        if eventType == "windows_generic_MSG":
            msg = ctypes.wintypes.MSG.from_address(message.__int__())
            # 获取鼠标移动经过时的坐标
            x = win32api.LOWORD(msg.lParam) - self.frameGeometry().x()
            y = win32api.HIWORD(msg.lParam) - self.frameGeometry().y()
            # 判断鼠标位置是否有其它控件
            if self.childAt(x, y) != None:
                return retval, result
            if msg.message == win32con.WM_NCCALCSIZE:
                # 拦截不显示顶部的系统自带的边框
                return True, 0
            if msg.message == win32con.WM_GETMINMAXINFO:
                # 当窗口位置改变或者大小改变时会触发该消息
                info = ctypes.cast(
                    msg.lParam, ctypes.POINTER(MINMAXINFO)).contents
                # 修改最大化的窗口大小为主屏幕的可用大小
                info.ptMaxSize.x = self._rect.width()
                info.ptMaxSize.y = self._rect.height()
                # 修改放置点的x,y坐标为0,0
                info.ptMaxPosition.x, info.ptMaxPosition.y = 0, 0
            if msg.message == win32con.WM_NCHITTEST:
                w, h = self.width(), self.height()
                lx = x < self.BorderWidth
                rx = x > w - self.BorderWidth
                ty = y < self.BorderWidth
                by = y > h - self.BorderWidth
                # 左上角
                if (lx and ty):
                    return True, win32con.HTTOPLEFT
                # 右下角
                if (rx and by):
                    return True, win32con.HTBOTTOMRIGHT
                # 右上角
                if (rx and ty):
                    return True, win32con.HTTOPRIGHT
                # 左下角
                if (lx and by):
                    return True, win32con.HTBOTTOMLEFT
                # 上
                if ty:
                    return True, win32con.HTTOP
                # 下
                if by:
                    return True, win32con.HTBOTTOM
                # 左
                if lx:
                    return True, win32con.HTLEFT
                # 右
                if rx:
                    return True, win32con.HTRIGHT
                # 标题
                return True, win32con.HTCAPTION
        return retval, result 
Example #25
Source File: Settings.py    From Jade-Application-Kit with GNU General Public License v3.0 4 votes vote down vote up
def config():
    return {
        "debug": False,
        "remote-debug": False,
        "setAAttribute": (),
        "disableGPU": False,
        "window": {
            "title": "Jade Application Kit",
            "icon": None,
            "backgroundImage": None,
            "setFlags": Qt.Window,
            "setAttribute": (),
            "state": None,
            "fullScreen": False,
            "transparent": False,
            "toolbar": None,
            "menus": None,
            "SystemTrayIcon": False,
            "showHelpMenu": False,
        },
        "webview": {
            "webContents": "https://codesardine.github.io/Jade-Application-Kit",
            "online": False,
            "urlRules": None,
            "cookiesPath": None,
            "userAgent": None,
            "addCSS": None,
            "runJavaScript": None,
            "IPC": True,
            "MediaAudioVideoCapture": False,
            "MediaVideoCapture": False,
            "MediaAudioCapture": False,
            "Geolocation": False,
            "MouseLock": False,
            "DesktopVideoCapture": False,
            "DesktopAudioVideoCapture": False,
            "injectJavaScript": {
                "JavaScript": None,
                "name": "Application Script"
            },
            "webChannel": {
                "active": False,
                "sharedOBJ": None
            },
            "enabledSettings": (
                QWebEngineSettings.JavascriptCanPaste,
                QWebEngineSettings.FullScreenSupportEnabled,
                QWebEngineSettings.AllowWindowActivationFromJavaScript,
                QWebEngineSettings.LocalContentCanAccessRemoteUrls,
                QWebEngineSettings.JavascriptCanAccessClipboard,
                QWebEngineSettings.SpatialNavigationEnabled,
                QWebEngineSettings.TouchIconsEnabled
            ),
            "disabledSettings": (
                QWebEngineSettings.PlaybackRequiresUserGesture
            )
        }
} 
Example #26
Source File: ModulatorDialog.py    From urh with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, modulators, tree_model=None, parent=None):
        """
        :type modulators: list of Modulator
        """
        super().__init__(parent)

        self.ui = Ui_DialogModulation()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowFlags(Qt.Window)

        self.lock_samples_in_view = False

        if tree_model is not None:
            self.ui.treeViewSignals.setModel(tree_model)
            self.ui.treeViewSignals.expandAll()
            self.ui.gVOriginalSignal.signal_tree_root = tree_model.rootItem

        self.ui.comboBoxCustomModulations.clear()
        for modulator in modulators:
            self.ui.comboBoxCustomModulations.addItem(modulator.name)
        if len(modulators) == 1:
            self.ui.btnRemoveModulation.setDisabled(True)

        self.modulators = modulators

        self.set_ui_for_current_modulator()

        self.ui.cbShowDataBitsOnly.setText(self.tr("Show Only Data Sequence\n"))
        self.ui.cbShowDataBitsOnly.setEnabled(False)
        self.protocol = None  # type: ProtocolAnalyzer
        self.search_results = []
        self.ui.cbShowDataBitsOnly.setEnabled(False)
        self.ui.btnSearchNext.setEnabled(False)
        self.ui.btnSearchPrev.setEnabled(False)

        self.ui.chkBoxLockSIV.setDisabled(True)

        self.original_bits = ""

        self.restore_bits_action = self.ui.linEdDataBits.addAction(QIcon.fromTheme("edit-undo"),
                                                                   QLineEdit.TrailingPosition)
        self.restore_bits_action.setEnabled(False)

        self.configure_parameters_action = self.ui.lineEditParameters.addAction(QIcon.fromTheme("configure"),
                                                                                QLineEdit.TrailingPosition)

        self.create_connects()
        self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes))

        self.set_bits_per_symbol_enabled_status()
        self.set_modulation_profile_status()

        # Ensure full srceen shown after resize
        QTimer.singleShot(100, self.show_full_scene) 
Example #27
Source File: Widgets.py    From Jade-Application-Kit with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent, menus):

        super(Menu, self).__init__(parent)
        if menus:
            for menu in menus:
                if type(menu) is dict:
                    title = self.addMenu(menu["title"])
                    for entry in menu["entries"]:
                        submenu = QAction(entry[0], self)
                        title.addAction(submenu)
                        print(entry[1])
                        submenu.triggered.connect(self._on_click(entry[1]))

        help_menu = {"title": "Keyboard Shortcuts", "text": """
                <body style='margin-right:46px;'><b>
                    F11 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Toggle Full Screen 
                <br>
                    F10 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Toggle Corner Window
                <br>
                    CTRL + &nbsp; &nbsp; Zoom In  
                <br>
                    CTRL - &nbsp; &nbsp;  Zoom Out  
                </body>
        """},\
        {"title": "About JAK", "text": """
                <body style='margin-right:46px;'>
                <small>
                    This online application is copyright and ownership of their respective authors.
                    <br><br>
                    This wrapper offers the ability to run web applications, as a self contained native desktop application.
                    Enjoy.
                </small>
                <br>
                <center>
                <b><small>
                    Powered by:
                </b></small>
                <a href='https://github.com/codesardine/Jade-Application-Kit'>Jade Application Kit</a><center>
                <small>
                Native Hybrid Apps on Linux.
                <br>
                    <b>
                        Using QT WebEngine
                    <b>
                </small>
                <br>
                <small>
                    <br>
                        This application comes with no warranty. License: <b>GPL</b>
                    <br>
                        Author:<b>Vitor Lopes<b>
                </small>
                </center>
                </body>
        """}

        help = self.addMenu("Help")
        for entry in help_menu:
            submenu = QAction(entry["title"], self)
            submenu.triggered.connect(self._on_click(entry["text"], entry["title"]))
            help.addAction(submenu) 
Example #28
Source File: ProjectDialog.py    From urh with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, new_project=True, project_manager: ProjectManager = None, parent=None):
        super().__init__(parent)
        if not new_project:
            assert project_manager is not None

        self.ui = Ui_ProjectDialog()
        self.ui.setupUi(self)
        self.setWindowFlags(Qt.Window)

        if new_project:
            self.participant_table_model = ParticipantTableModel([])
        else:
            self.participant_table_model = ParticipantTableModel(project_manager.participants)

            self.ui.spinBoxSampleRate.setValue(project_manager.device_conf["sample_rate"])
            self.ui.spinBoxFreq.setValue(project_manager.device_conf["frequency"])
            self.ui.spinBoxBandwidth.setValue(project_manager.device_conf["bandwidth"])
            self.ui.spinBoxGain.setValue(project_manager.device_conf.get("gain", config.DEFAULT_GAIN))
            self.ui.txtEdDescription.setPlainText(project_manager.description)
            self.ui.lineEdit_Path.setText(project_manager.project_path)
            self.ui.lineEditBroadcastAddress.setText(project_manager.broadcast_address_hex)

            self.ui.btnSelectPath.hide()
            self.ui.lineEdit_Path.setDisabled(True)
            self.setWindowTitle("Edit project settings")
            self.ui.lNewProject.setText("Edit project")

        self.ui.tblParticipants.setModel(self.participant_table_model)
        self.participant_table_model.update()

        self.ui.lineEditBroadcastAddress.setValidator(QRegExpValidator(QRegExp("([a-fA-F ]|[0-9]){,}")))

        self.sample_rate = self.ui.spinBoxSampleRate.value()
        self.freq = self.ui.spinBoxFreq.value()
        self.bandwidth = self.ui.spinBoxBandwidth.value()
        self.gain = self.ui.spinBoxGain.value()
        self.description = self.ui.txtEdDescription.toPlainText()
        self.broadcast_address_hex = self.ui.lineEditBroadcastAddress.text()

        self.path = self.ui.lineEdit_Path.text()
        self.new_project = new_project
        self.committed = False
        self.setModal(True)

        completer = QCompleter()
        completer.setModel(QDirModel(completer))
        self.ui.lineEdit_Path.setCompleter(completer)

        self.create_connects()
        # add two participants
        if self.participant_table_model.rowCount() == 0 and new_project:
            self.ui.btnAddParticipant.click()
            self.ui.btnAddParticipant.click()

        if new_project:
            self.ui.lineEdit_Path.setText(os.path.realpath(os.path.join(os.curdir, "new")))

        self.on_line_edit_path_text_edited()
        self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) 
Example #29
Source File: ProtocolLabelDialog.py    From urh with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, message: Message, viewtype: int, selected_index=None, parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogLabels()
        self.ui.setupUi(self)
        util.set_splitter_stylesheet(self.ui.splitter)

        field_types = FieldType.load_from_xml()
        self.model = PLabelTableModel(message, field_types)

        self.ui.tblViewProtoLabels.setItemDelegateForColumn(0, ComboBoxDelegate([ft.caption for ft in field_types],
                                                                                is_editable=True,
                                                                                return_index=False, parent=self))
        self.ui.tblViewProtoLabels.setItemDelegateForColumn(1, SpinBoxDelegate(1, len(message), self))
        self.ui.tblViewProtoLabels.setItemDelegateForColumn(2, SpinBoxDelegate(1, len(message), self))
        self.ui.tblViewProtoLabels.setItemDelegateForColumn(3,
                                                            ComboBoxDelegate([""] * len(settings.LABEL_COLORS),
                                                                             colors=settings.LABEL_COLORS,
                                                                             parent=self))
        self.ui.tblViewProtoLabels.setItemDelegateForColumn(4, CheckBoxDelegate(self))
        self.ui.tblViewProtoLabels.setModel(self.model)
        self.ui.tblViewProtoLabels.setEditTriggers(QAbstractItemView.AllEditTriggers)

        self.ui.tblViewProtoLabels.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        self.ui.tblViewProtoLabels.resizeColumnsToContents()
        self.setWindowFlags(Qt.Window)
        self.setWindowTitle(self.tr("Edit Protocol Labels From Message Type %s") % message.message_type.name)

        self.configure_special_config_tabs()
        self.ui.splitter.setSizes([int(self.height() / 2), int(self.height() / 2)])

        self.create_connects()

        if selected_index is not None:
            self.ui.tblViewProtoLabels.setCurrentIndex(self.model.index(selected_index, 0))

        self.ui.cbProtoView.setCurrentIndex(viewtype)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowFlags(Qt.Window)

        self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes))

        for i in range(self.model.rowCount()):
            self.open_editors(i)