class Ui_VehicleRentalDlg(object):
    def setupUi(self, VehicleRentalDlg):
        if not VehicleRentalDlg.objectName():
            VehicleRentalDlg.setObjectName(u"VehicleRentalDlg")
        VehicleRentalDlg.resize(206, 246)
        self.gridLayout = QGridLayout(VehicleRentalDlg)
        # ifndef Q_OS_MAC
        self.gridLayout.setSpacing(6)
        # endif
        # ifndef Q_OS_MAC
        self.gridLayout.setContentsMargins(9, 9, 9, 9)
        # endif
        self.gridLayout.setObjectName(u"gridLayout")
        self.buttonBox = QDialogButtonBox(VehicleRentalDlg)
        self.buttonBox.setObjectName(u"buttonBox")
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                          | QDialogButtonBox.Ok)

        self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 1)

        self.spacerItem = QSpacerItem(188, 16, QSizePolicy.Minimum,
                                      QSizePolicy.Expanding)

        self.gridLayout.addItem(self.spacerItem, 3, 0, 1, 1)

        self.hboxLayout = QHBoxLayout()
        # ifndef Q_OS_MAC
        self.hboxLayout.setSpacing(6)
        # endif
        self.hboxLayout.setContentsMargins(0, 0, 0, 0)
        self.hboxLayout.setObjectName(u"hboxLayout")
        self.label_6 = QLabel(VehicleRentalDlg)
        self.label_6.setObjectName(u"label_6")

        self.hboxLayout.addWidget(self.label_6)

        self.mileageLabel = QLabel(VehicleRentalDlg)
        self.mileageLabel.setObjectName(u"mileageLabel")
        self.mileageLabel.setFrameShape(QFrame.StyledPanel)
        self.mileageLabel.setFrameShadow(QFrame.Sunken)
        self.mileageLabel.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                       | Qt.AlignVCenter)

        self.hboxLayout.addWidget(self.mileageLabel)

        self.gridLayout.addLayout(self.hboxLayout, 2, 0, 1, 1)

        self.stackedWidget = QStackedWidget(VehicleRentalDlg)
        self.stackedWidget.setObjectName(u"stackedWidget")
        self.page_2 = QWidget()
        self.page_2.setObjectName(u"page_2")
        self.gridLayout1 = QGridLayout(self.page_2)
        # ifndef Q_OS_MAC
        self.gridLayout1.setSpacing(6)
        # endif
        # ifndef Q_OS_MAC
        self.gridLayout1.setContentsMargins(9, 9, 9, 9)
        # endif
        self.gridLayout1.setObjectName(u"gridLayout1")
        self.colorComboBox = QComboBox(self.page_2)
        self.colorComboBox.addItem("")
        self.colorComboBox.addItem("")
        self.colorComboBox.addItem("")
        self.colorComboBox.addItem("")
        self.colorComboBox.addItem("")
        self.colorComboBox.addItem("")
        self.colorComboBox.addItem("")
        self.colorComboBox.setObjectName(u"colorComboBox")

        self.gridLayout1.addWidget(self.colorComboBox, 0, 1, 1, 1)

        self.label_4 = QLabel(self.page_2)
        self.label_4.setObjectName(u"label_4")

        self.gridLayout1.addWidget(self.label_4, 0, 0, 1, 1)

        self.label_5 = QLabel(self.page_2)
        self.label_5.setObjectName(u"label_5")

        self.gridLayout1.addWidget(self.label_5, 1, 0, 1, 1)

        self.seatsSpinBox = QSpinBox(self.page_2)
        self.seatsSpinBox.setObjectName(u"seatsSpinBox")
        self.seatsSpinBox.setAlignment(Qt.AlignRight)
        self.seatsSpinBox.setMinimum(2)
        self.seatsSpinBox.setMaximum(12)
        self.seatsSpinBox.setValue(4)

        self.gridLayout1.addWidget(self.seatsSpinBox, 1, 1, 1, 1)

        self.stackedWidget.addWidget(self.page_2)
        self.page = QWidget()
        self.page.setObjectName(u"page")
        self.gridLayout2 = QGridLayout(self.page)
        # ifndef Q_OS_MAC
        self.gridLayout2.setSpacing(6)
        # endif
        # ifndef Q_OS_MAC
        self.gridLayout2.setContentsMargins(9, 9, 9, 9)
        # endif
        self.gridLayout2.setObjectName(u"gridLayout2")
        self.weightSpinBox = QSpinBox(self.page)
        self.weightSpinBox.setObjectName(u"weightSpinBox")
        self.weightSpinBox.setAlignment(Qt.AlignRight)
        self.weightSpinBox.setMinimum(1)
        self.weightSpinBox.setMaximum(8)

        self.gridLayout2.addWidget(self.weightSpinBox, 0, 1, 1, 1)

        self.label_3 = QLabel(self.page)
        self.label_3.setObjectName(u"label_3")

        self.gridLayout2.addWidget(self.label_3, 1, 0, 1, 1)

        self.label_2 = QLabel(self.page)
        self.label_2.setObjectName(u"label_2")

        self.gridLayout2.addWidget(self.label_2, 0, 0, 1, 1)

        self.volumeSpinBox = QSpinBox(self.page)
        self.volumeSpinBox.setObjectName(u"volumeSpinBox")
        self.volumeSpinBox.setAlignment(Qt.AlignRight)
        self.volumeSpinBox.setMinimum(4)
        self.volumeSpinBox.setMaximum(22)
        self.volumeSpinBox.setValue(10)

        self.gridLayout2.addWidget(self.volumeSpinBox, 1, 1, 1, 1)

        self.stackedWidget.addWidget(self.page)

        self.gridLayout.addWidget(self.stackedWidget, 1, 0, 1, 1)

        self.hboxLayout1 = QHBoxLayout()
        # ifndef Q_OS_MAC
        self.hboxLayout1.setSpacing(6)
        # endif
        self.hboxLayout1.setContentsMargins(0, 0, 0, 0)
        self.hboxLayout1.setObjectName(u"hboxLayout1")
        self.label = QLabel(VehicleRentalDlg)
        self.label.setObjectName(u"label")

        self.hboxLayout1.addWidget(self.label)

        self.vehicleComboBox = QComboBox(VehicleRentalDlg)
        self.vehicleComboBox.addItem("")
        self.vehicleComboBox.addItem("")
        self.vehicleComboBox.setObjectName(u"vehicleComboBox")

        self.hboxLayout1.addWidget(self.vehicleComboBox)

        self.gridLayout.addLayout(self.hboxLayout1, 0, 0, 1, 1)

        # if QT_CONFIG(shortcut)
        self.label_4.setBuddy(self.colorComboBox)
        self.label_5.setBuddy(self.seatsSpinBox)
        self.label_3.setBuddy(self.volumeSpinBox)
        self.label_2.setBuddy(self.seatsSpinBox)
        self.label.setBuddy(self.vehicleComboBox)
        # endif // QT_CONFIG(shortcut)

        self.retranslateUi(VehicleRentalDlg)
        self.vehicleComboBox.currentIndexChanged.connect(
            self.stackedWidget.setCurrentIndex)
        self.buttonBox.accepted.connect(VehicleRentalDlg.accept)
        self.buttonBox.rejected.connect(VehicleRentalDlg.reject)

        self.stackedWidget.setCurrentIndex(0)

        QMetaObject.connectSlotsByName(VehicleRentalDlg)

    # setupUi

    def retranslateUi(self, VehicleRentalDlg):
        VehicleRentalDlg.setWindowTitle(
            QCoreApplication.translate("VehicleRentalDlg", u"Vehicle Rental",
                                       None))
        self.label_6.setText(
            QCoreApplication.translate("VehicleRentalDlg", u"Max. Mileage:",
                                       None))
        self.mileageLabel.setText(
            QCoreApplication.translate("VehicleRentalDlg", u"1000 miles",
                                       None))
        self.colorComboBox.setItemText(
            0, QCoreApplication.translate("VehicleRentalDlg", u"Black", None))
        self.colorComboBox.setItemText(
            1, QCoreApplication.translate("VehicleRentalDlg", u"Blue", None))
        self.colorComboBox.setItemText(
            2, QCoreApplication.translate("VehicleRentalDlg", u"Green", None))
        self.colorComboBox.setItemText(
            3, QCoreApplication.translate("VehicleRentalDlg", u"Red", None))
        self.colorComboBox.setItemText(
            4, QCoreApplication.translate("VehicleRentalDlg", u"Silver", None))
        self.colorComboBox.setItemText(
            5, QCoreApplication.translate("VehicleRentalDlg", u"White", None))
        self.colorComboBox.setItemText(
            6, QCoreApplication.translate("VehicleRentalDlg", u"Yellow", None))

        self.label_4.setText(
            QCoreApplication.translate("VehicleRentalDlg", u"Co&lor:", None))
        self.label_5.setText(
            QCoreApplication.translate("VehicleRentalDlg", u"&Seats:", None))
        self.weightSpinBox.setSuffix(
            QCoreApplication.translate("VehicleRentalDlg", u" tons", None))
        self.label_3.setText(
            QCoreApplication.translate("VehicleRentalDlg", u"Volu&me:", None))
        self.label_2.setText(
            QCoreApplication.translate("VehicleRentalDlg", u"&Weight:", None))
        self.volumeSpinBox.setSuffix(
            QCoreApplication.translate("VehicleRentalDlg", u" cu m", None))
        self.label.setText(
            QCoreApplication.translate("VehicleRentalDlg", u"&Vehicle Type:",
                                       None))
        self.vehicleComboBox.setItemText(
            0, QCoreApplication.translate("VehicleRentalDlg", u"Car", None))
        self.vehicleComboBox.setItemText(
            1, QCoreApplication.translate("VehicleRentalDlg", u"Van", None))
Beispiel #2
0
 def __init__(
         self,
         config_file: str
 ) -> None:
     super().__init__()
     # load config
     try:
         self.config = Config(config_file)
     except Exception as e:
         QMessageBox.critical(self, 'Config error', str(e))
         QTimer.singleShot(0, self.close)
         return
     # load settings
     self.settings = Settings()
     # state
     self.state_key: Optional[int] = None
     # label widget
     self.label_ping = ClickableLabel('Loading ...', self.post_history)
     self.label_ping.setTextFormat(Qt.RichText)
     self.label_ping.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
     layout_ping = QGridLayout()
     layout_ping.setContentsMargins(0, 0, 0, 0)
     layout_ping.addWidget(self.label_ping)
     self.widget_ping = QWidget()
     self.widget_ping.setLayout(layout_ping)
     self.addWidget(self.widget_ping)
     # alert widget
     self.label_alert = QLabel()
     self.label_alert.setWordWrap(True)
     self.label_alert.setAlignment(Qt.AlignCenter)
     self.label_alert.setStyleSheet(f'background: #dddddd;')
     self.addWidget(self.label_alert)
     # context menu
     self.action_report_done = QAction('Report done ...')
     self.action_report_done.triggered.connect(self.report_done)
     self.action_exit = QAction('Exit')
     self.action_exit.triggered.connect(self.close)
     self.action_frameless = QAction('Frameless window')
     self.action_frameless.setCheckable(True)
     self.action_frameless.triggered.connect(self.set_frameless_window)
     self.action_homepage = QAction('Open homepage')
     self.action_homepage.triggered.connect(self.open_homepage)
     self.context_menu = QMenu()
     self.context_menu.addAction(self.action_report_done)
     self.context_menu.addAction(self.action_exit)
     self.context_menu.addAction(self.action_frameless)
     self.context_menu.addAction(self.action_homepage)
     # threads
     self.thread_communication = QThread()
     self.thread_communication.start()
     # workers
     self.worker_communication = CommunicationWorker(
         netloc=self.config.netloc,
         base_path=self.config.base_path,
         api_key=self.config.api_key,
         guild=self.config.guild,
         member=self.config.member)
     self.worker_communication.moveToThread(self.thread_communication)
     # signals
     self.worker_communication.signal_get_ping_done.connect(self.get_ping_done)
     self.worker_communication.signal_post_history_done.connect(self.post_history_done)
     self.signal_get_ping.connect(self.worker_communication.get_ping)
     self.signal_post_history.connect(self.worker_communication.post_history)
     # get ping timer
     QTimer.singleShot(0, self.get_ping)
     self.timer_ping = QTimer()
     self.timer_ping.timeout.connect(self.get_ping)
     self.timer_ping.setTimerType(Qt.VeryCoarseTimer)
     self.timer_ping.start(self.INTERVAL_SECS * 1000)
     # switch label timer
     self.timer_label = QTimer()
     self.timer_label.timeout.connect(lambda: self.setCurrentWidget(self.widget_ping))
     self.timer_label.setSingleShot(True)
     self.timer_label.setTimerType(Qt.CoarseTimer)
     # window attributes
     size = self.settings.get('window', 'size', type_=QSize)
     if size is not None:
         self.resize(size)
     pos = self.settings.get('window', 'pos', type_=QPoint)
     if pos is not None:
         self.move(pos)
     frameless = self.settings.get('window', 'frameless', type_=bool)
     if frameless is not None and frameless:
         QTimer.singleShot(100, self.action_frameless.trigger)
     self.setWindowFlag(Qt.WindowStaysOnTopHint, self.config.window_stays_on_top)
     self.setAttribute(Qt.WA_TranslucentBackground)
     self.setWindowTitle('Evelyn Reminder')
Beispiel #3
0
	def __init__(self, parent, data):
		super(SectionsWidget, self).__init__(parent)

		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setVerticalSpacing(1)
		layout.setHorizontalSpacing(UIContext.getScaledWindowSize(16, 16).width())

		maxNameLen = 0
		for section in data.sections.values():
			if len(section.name) > maxNameLen:
				maxNameLen = len(section.name)
		if maxNameLen > 32:
			maxNameLen = 32

		self.sections = []
		for section in data.sections.values():
			if section.semantics != SectionSemantics.ExternalSectionSemantics:
				self.sections.append(section)
		self.sections.sort(key = lambda section: section.start)

		row = 0
		for section in self.sections:
			name = section.name
			if len(name) > maxNameLen:
				name = name[:maxNameLen - 1] + "…"

			begin = "0x%x" % section.start
			end = "0x%x" % section.end
			typeName = section.type

			permissions = ""
			if data.is_offset_readable(section.start):
				permissions += "r"
			else:
				permissions += "-"
			if data.is_offset_writable(section.start):
				permissions += "w"
			else:
				permissions += "-"
			if data.is_offset_executable(section.start):
				permissions += "x"
			else:
				permissions += "-"

			semantics = ""
			if section.semantics == SectionSemantics.ReadOnlyCodeSectionSemantics:
				semantics = "Code"
			elif section.semantics == SectionSemantics.ReadOnlyDataSectionSemantics:
				semantics = "Read-only Data"
			elif section.semantics == SectionSemantics.ReadWriteDataSectionSemantics:
				semantics = "Writable Data"

			nameLabel = QLabel(name)
			nameLabel.setFont(binaryninjaui.getMonospaceFont(self))
			layout.addWidget(nameLabel, row, 0)

			rangeLayout = QHBoxLayout()
			rangeLayout.setContentsMargins(0, 0, 0, 0)
			beginLabel = headers.ClickableAddressLabel(begin)
			dashLabel = QLabel("-")
			dashLabel.setFont(binaryninjaui.getMonospaceFont(self))
			endLabel = headers.ClickableAddressLabel(end)
			rangeLayout.addWidget(beginLabel)
			rangeLayout.addWidget(dashLabel)
			rangeLayout.addWidget(endLabel)
			layout.addLayout(rangeLayout, row, 1)

			permissionsLabel = QLabel(permissions)
			permissionsLabel.setFont(binaryninjaui.getMonospaceFont(self))
			layout.addWidget(permissionsLabel, row, 2)
			typeLabel = QLabel(typeName)
			typeLabel.setFont(binaryninjaui.getMonospaceFont(self))
			layout.addWidget(typeLabel, row, 3)
			semanticsLabel = QLabel(semantics)
			semanticsLabel.setFont(binaryninjaui.getMonospaceFont(self))
			layout.addWidget(semanticsLabel, row, 4)

			row += 1

		layout.setColumnStretch(5, 1)
		self.setLayout(layout)