def __init__(self): super().__init__() self.resize(1020, 900) self.html = webkit.QWebView(self) self.setCentralWidget(self.html)
class FlaskServerThread(threading.Thread): def run(self): print("Start Flask Server!") flask_app.run(host="0.0.0.0") flask_app = Flask(__name__) @flask_app.route("/") def hello(): return render_template("index.html") if __name__ == "__main__": fserver = FlaskServerThread() fserver.setDaemon(True) fserver.start() qapp = QApplication(sys.argv) print("QT Ver: %s" % QT_VERSION_STR) if QV[0] == 5 and QV[1] >= 6: view = QWebEngineView() else: view = QtWebKitWidgets.QWebView() view.load(QUrl("http://localhost:5000")) view.show() sys.exit(qapp.exec_())
def setupUi(self, MapWindow): self.MapWindow = MapWindow MapWindow.setObjectName("MapWindow") MapWindow.resize(1402, 1050) MapWindow.setMinimumSize(QtCore.QSize(1402, 1050)) MapWindow.setMaximumSize(QtCore.QSize(1402, 1050)) self.centralwidget = QtWidgets.QWidget(MapWindow) self.centralwidget.setMinimumSize(QtCore.QSize(1402, 1025)) self.centralwidget.setMaximumSize(QtCore.QSize(1402, 1025)) self.centralwidget.setObjectName("centralwidget") self.backButton = QtWidgets.QPushButton(self.centralwidget) self.backButton.setGeometry(QtCore.QRect(60, 20, 93, 30)) self.backButton.setObjectName("backButton") # self.stepButton = QtWidgets.QPushButton(self.centralwidget) # self.stepButton.setGeometry(QtCore.QRect(1150, 20, 191, 30)) # self.stepButton.setObjectName("stepButton") self.customerLabel = QtWidgets.QLabel(self.centralwidget) self.customerLabel.setGeometry(QtCore.QRect(55, 720, 700, 31)) font = QtGui.QFont() font.setPointSize(14) font.setWeight(75) font.setBold(True) self.customerLabel.setFont(font) self.customerLabel.setObjectName("customerLabel") self.customerLabel.setStyleSheet("background-color: #32414b;") self.initialLabel = QtWidgets.QLabel(self.centralwidget) self.initialLabel.setGeometry(QtCore.QRect(60, 770, 600, 31)) self.initialLabel.setObjectName("initialLabel") self.initialLabel.setStyleSheet("background-color: #32414b;") self.finalLabel = QtWidgets.QLabel(self.centralwidget) self.finalLabel.setGeometry(QtCore.QRect(60, 800, 600, 31)) self.finalLabel.setObjectName("finalLabel") self.finalLabel.setStyleSheet("background-color: #32414b;") self.startLabel = QtWidgets.QLabel(self.centralwidget) self.startLabel.setGeometry(QtCore.QRect(730, 770, 361, 31)) self.startLabel.setObjectName("startLabel") self.startLabel.setStyleSheet("background-color: #32414b;") # self.arrivalLabel = QtWidgets.QLabel(self.centralwidget) # self.arrivalLabel.setGeometry(QtCore.QRect(730, 800, 361, 31)) # self.arrivalLabel.setObjectName("arrivalLabel") # self.arrivalLabel.setStyleSheet("background-color: #32414b;") self.distanceLabel = QtWidgets.QLabel(self.centralwidget) self.distanceLabel.setGeometry(QtCore.QRect(60, 830, 361, 31)) self.distanceLabel.setObjectName("distanceLabel") self.distanceLabel.setStyleSheet("background-color: #32414b;") self.durationLabel = QtWidgets.QLabel(self.centralwidget) self.durationLabel.setGeometry(QtCore.QRect(730, 800, 361, 31)) self.durationLabel.setObjectName("durationLabel") self.durationLabel.setStyleSheet("background-color: #32414b;") self.deliveryButton = QtWidgets.QPushButton(self.centralwidget) self.deliveryButton.setGeometry(QtCore.QRect(610, 950, 191, 41)) self.deliveryButton.setObjectName("pushButton") self.oneStar = QtWidgets.QRadioButton(self.centralwidget) self.oneStar.setGeometry(QtCore.QRect(555, 913, 61, 20)) self.oneStar.setObjectName("oneStar") self.twoStar = QtWidgets.QRadioButton(self.centralwidget) self.twoStar.setGeometry(QtCore.QRect(625, 913, 71, 20)) self.twoStar.setObjectName("twoStar") self.threeStar = QtWidgets.QRadioButton(self.centralwidget) self.threeStar.setGeometry(QtCore.QRect(705, 913, 81, 20)) self.threeStar.setObjectName("threeStar") self.fourStar = QtWidgets.QRadioButton(self.centralwidget) self.fourStar.setGeometry(QtCore.QRect(795, 913, 81, 20)) self.fourStar.setObjectName("fourStar") self.fiveStar = QtWidgets.QRadioButton(self.centralwidget) self.fiveStar.setGeometry(QtCore.QRect(895, 913, 95, 20)) self.fiveStar.setObjectName("fiveStar") self.rateLabel = QtWidgets.QLabel(self.centralwidget) self.rateLabel.setGeometry(QtCore.QRect(430, 910, 121, 25)) self.rateLabel.setObjectName("rateLabel") self.background = QtWidgets.QLabel(self.centralwidget) self.background.setGeometry(QtCore.QRect(0, 700, 1402, 181)) self.background.setStyleSheet("background-color: #32414b;") self.background.setText("") self.background.setObjectName("background") self.background.lower() font = QtGui.QFont() font.setPointSize(9.5) self.initialLabel.setFont(font) self.finalLabel.setFont(font) self.startLabel.setFont(font) # self.arrivalLabel.setFont(font) self.distanceLabel.setFont(font) self.durationLabel.setFont(font) self.radioButtons = [ self.oneStar, self.twoStar, self.threeStar, self.fourStar, self.fiveStar ] self.centralwidget.keyPressEvent = self.keyPressEvent MapWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(MapWindow) self.statusbar.setObjectName("statusbar") MapWindow.setStatusBar(self.statusbar) self.backButton.clicked.connect(self.switch_mainWindow) self.deliveryButton.clicked.connect(self.delivery_complete) self.web = QtWebKitWidgets.QWebView(self.centralwidget) self.web.setGeometry(QtCore.QRect(0, 70, 1400, 610)) self.web.load( QtCore.QUrl( "https://www.google.com/maps/dir/" + self.formatForURL(self.currentUser.getAddress()) + "/" + self.formatForURL(self.currentUser.getCustomerAddress()))) self.web.show() self.retranslateUi(MapWindow) QtCore.QMetaObject.connectSlotsByName(MapWindow)
def __init__(self, parent=None): QtWidgets.QStackedWidget.__init__(self, parent) self.diary_widget = parent self.patient_label = QtWidgets.QLabel() icon = QtGui.QIcon(":/search.png") self.get_patient_button = QtWidgets.QPushButton(icon, "") self.get_patient_button.setMaximumWidth(40) self.appt_listView = DraggableList(self) self.block_listView = DraggableList(self) self.item_delegate = ColouredItemDelegate(self) self.appointment_model = SimpleListModel(self) self.appt_listView.setModel(self.appointment_model) self.appt_listView.setItemDelegate(self.item_delegate) self.appt_listView.setSelectionModel( self.appointment_model.selection_model) self.appt_listView.setSelectionMode( QtWidgets.QListView.ContiguousSelection) block_model = BlockListModel(self) self.block_listView.setModel(block_model) icon = QtGui.QIcon(":vcalendar.png") diary_button = QtWidgets.QPushButton(icon, _("Diary")) diary_button.setToolTip(_("Open the patient's diary")) icon = QtGui.QIcon(":settings.png") settings_button = QtWidgets.QPushButton(icon, _("Options")) settings_button.setToolTip(_("Appointment Settings")) icon = QtGui.QIcon(":back.png") self.prev_appt_button = QtWidgets.QPushButton(icon, "") self.prev_appt_button.setToolTip(_("Previous appointment")) icon = QtGui.QIcon(":forward.png") self.next_appt_button = QtWidgets.QPushButton(icon, "") self.next_appt_button.setToolTip(_("Next available appointment")) icon = QtGui.QIcon(":forward.png") self.next_day_button = QtWidgets.QPushButton(icon, "") self.next_day_button.setToolTip(_("Next Day or Week")) icon = QtGui.QIcon(":back.png") self.prev_day_button = QtWidgets.QPushButton(icon, "") self.prev_day_button.setToolTip(_("Previous Day or Week")) icon = QtGui.QIcon(":first.png") self.first_appt_button = QtWidgets.QPushButton(icon, "") self.first_appt_button.setToolTip(_("First available appointment")) self.appt_controls_frame = QtWidgets.QWidget() layout = QtWidgets.QGridLayout(self.appt_controls_frame) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(2) layout.addWidget(diary_button, 0, 0, 1, 2) layout.addWidget(settings_button, 0, 3, 1, 2) layout.addWidget(self.prev_day_button, 1, 0) layout.addWidget(self.prev_appt_button, 1, 1) layout.addWidget(self.first_appt_button, 1, 2) layout.addWidget(self.next_appt_button, 1, 3) layout.addWidget(self.next_day_button, 1, 4) self.appt_controls_frame.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)) self.search_criteria_webview = QtWebKitWidgets.QWebView(self) self.search_criteria_webview.setMinimumHeight(100) self.search_criteria_webview.setHtml( _("No appointment selected for scheduling")) # now arrange the stacked widget # page 0 - Browsing mode self.browsing_webview = QtWebKitWidgets.QWebView(self) self.reset_browsing_webview() self.addWidget(self.browsing_webview) # page 1 -- scheduling mode widg = QtWidgets.QWidget() layout = QtWidgets.QGridLayout(widg) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.patient_label, 0, 0) layout.addWidget(self.get_patient_button, 0, 1) layout.addWidget(self.appt_listView, 2, 0, 1, 2) layout.addWidget(self.appt_controls_frame, 3, 0, 1, 2) layout.addWidget(self.search_criteria_webview, 4, 0, 1, 2) self.addWidget(widg) # page 2 -- blocking mode widg = QtWidgets.QWidget() layout = QtWidgets.QVBoxLayout(widg) layout.addWidget(self.block_listView) self.addWidget(widg) # page 4 -- notes mode self.notes_label = QtWidgets.QLabel( _("Select a patient to edit notes")) self.addWidget(self.notes_label) # connect signals self.get_patient_button.clicked.connect(self.find_patient) settings_button.clicked.connect(self.show_settings_dialog) self.prev_appt_button.clicked.connect(self.show_prev_appt) self.next_appt_button.clicked.connect(self.show_next_appt) self.prev_day_button.clicked.connect(self.show_prev_day) self.next_day_button.clicked.connect(self.show_next_day) self.first_appt_button.clicked.connect(self.find_first_appointment) diary_button.clicked.connect(self.show_pt_diary) self.appt_listView.selectionModel().selectionChanged.connect( self.selection_changed) self.appt_listView.doubleClicked.connect(self.appointment_2x_clicked)
def __init__(self, parent): super(BrowserWindow, self).__init__(parent) self.view = QtWebKitWidgets.QWebView(self) self.setWindowTitle('Bitmask') self.resize(800, 600) self.load_app()
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(1200, 768) Dialog.setMinimumSize(QtCore.QSize(1200, 768)) self.horizontalLayout_6 = QtWidgets.QHBoxLayout(Dialog) self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setSizeConstraint( QtWidgets.QLayout.SetMinimumSize) self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setSizeConstraint( QtWidgets.QLayout.SetMaximumSize) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setSizeConstraint( QtWidgets.QLayout.SetDefaultConstraint) self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.radioButton_contentTable = QtWidgets.QRadioButton(Dialog) self.radioButton_contentTable.setMinimumSize(QtCore.QSize(120, 30)) self.radioButton_contentTable.setMaximumSize(QtCore.QSize(120, 30)) self.radioButton_contentTable.setStyleSheet( "background-color: rgb(204, 204, 204);\n" "padding-left:5px;") self.radioButton_contentTable.setChecked(True) self.radioButton_contentTable.setObjectName("radioButton_contentTable") self.horizontalLayout_4.addWidget(self.radioButton_contentTable) spacerItem = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem) self.radioButton_chapter1 = QtWidgets.QRadioButton(Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.radioButton_chapter1.sizePolicy().hasHeightForWidth()) self.radioButton_chapter1.setSizePolicy(sizePolicy) self.radioButton_chapter1.setMinimumSize(QtCore.QSize(120, 30)) self.radioButton_chapter1.setMaximumSize(QtCore.QSize(120, 30)) self.radioButton_chapter1.setStyleSheet( "background-color: rgb(204, 204, 204);padding-left:5px;") self.radioButton_chapter1.setObjectName("radioButton_chapter1") self.horizontalLayout_4.addWidget(self.radioButton_chapter1) spacerItem1 = QtWidgets.QSpacerItem(320, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem1) self.verticalLayout_2.addLayout(self.horizontalLayout_4) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setSizeConstraint( QtWidgets.QLayout.SetMaximumSize) self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.webView = QtWebKitWidgets.QWebView(Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.webView.sizePolicy().hasHeightForWidth()) self.webView.setSizePolicy(sizePolicy) self.webView.setMinimumSize(QtCore.QSize(400, 720)) self.webView.setMaximumSize(QtCore.QSize(600, 16777215)) self.webView.setStyleSheet("background-color: rgb(230, 230, 230);") self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.horizontalLayout_5.addWidget(self.webView) self.verticalLayout_2.addLayout(self.horizontalLayout_5) self.horizontalLayout.addLayout(self.verticalLayout_2) self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setSpacing(0) self.verticalLayout_4.setObjectName("verticalLayout_4") self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.label_2 = QtWidgets.QLabel(Dialog) self.label_2.setMinimumSize(QtCore.QSize(80, 30)) self.label_2.setMaximumSize(QtCore.QSize(80, 30)) self.label_2.setAutoFillBackground(False) self.label_2.setStyleSheet("background-color: rgb(117, 117, 117);\n" "color: rgb(255, 255, 255);\n" "padding-left:6px;") self.label_2.setObjectName("label_2") self.horizontalLayout_8.addWidget(self.label_2) spacerItem2 = QtWidgets.QSpacerItem(30, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem2) self.verticalLayout_4.addLayout(self.horizontalLayout_8) self.horizontalLayout_9 = QtWidgets.QHBoxLayout() self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.plainTextEdit = QtWidgets.QPlainTextEdit(Dialog) self.plainTextEdit.setMinimumSize(QtCore.QSize(300, 720)) self.plainTextEdit.setAcceptDrops(False) self.plainTextEdit.setReadOnly(True) self.plainTextEdit.setObjectName("plainTextEdit") self.horizontalLayout_9.addWidget(self.plainTextEdit) self.verticalLayout_4.addLayout(self.horizontalLayout_9) self.horizontalLayout.addLayout(self.verticalLayout_4) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label = QtWidgets.QLabel(Dialog) self.label.setMinimumSize(QtCore.QSize(80, 30)) self.label.setMaximumSize(QtCore.QSize(80, 30)) self.label.setAutoFillBackground(False) self.label.setStyleSheet("background-color: rgb(117, 117, 117);\n" "color: rgb(255, 255, 255);\n" "padding-left:6px;") self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) self.presetButton = QtWidgets.QPushButton(Dialog) self.presetButton.setMinimumSize(QtCore.QSize(0, 30)) self.presetButton.setMaximumSize(QtCore.QSize(16777215, 30)) self.presetButton.setObjectName("presetButton") self.horizontalLayout_2.addWidget(self.presetButton) spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem3) self.pushButtonPreview = QtWidgets.QPushButton(Dialog) self.pushButtonPreview.setMinimumSize(QtCore.QSize(0, 30)) self.pushButtonPreview.setMaximumSize(QtCore.QSize(16777215, 30)) self.pushButtonPreview.setObjectName("pushButtonPreview") self.horizontalLayout_2.addWidget(self.pushButtonPreview) self.pushButtonSave = QtWidgets.QPushButton(Dialog) self.pushButtonSave.setMinimumSize(QtCore.QSize(0, 30)) self.pushButtonSave.setMaximumSize(QtCore.QSize(16777215, 30)) self.pushButtonSave.setObjectName("pushButtonSave") self.horizontalLayout_2.addWidget(self.pushButtonSave) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setSizeConstraint( QtWidgets.QLayout.SetMinimumSize) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.textEdit = QtWidgets.QTextEdit(Dialog) self.textEdit.setMinimumSize(QtCore.QSize(500, 720)) self.textEdit.setMaximumSize(QtCore.QSize(600, 16777215)) self.textEdit.setStyleSheet("background-color: rgb(220, 220, 220);") self.textEdit.setFrameShape(QtWidgets.QFrame.NoFrame) self.textEdit.setFrameShadow(QtWidgets.QFrame.Plain) self.textEdit.setLineWidth(0) self.textEdit.setObjectName("textEdit") self.horizontalLayout_3.addWidget(self.textEdit) self.verticalLayout.addLayout(self.horizontalLayout_3) self.horizontalLayout.addLayout(self.verticalLayout) self.horizontalLayout_6.addLayout(self.horizontalLayout) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(768, 1300) MainWindow.setStyleSheet("color: white; background-color: black;") self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.groupBox = QtWidgets.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(10, 40, 311, 151)) self.groupBox.setStyleSheet( "color: white; background-color: black; border:0;") self.groupBox.setTitle("") self.groupBox.setObjectName("groupBox") self.gridLayout = QtWidgets.QGridLayout(self.groupBox) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(self.groupBox) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(48) font.setBold(True) font.setWeight(75) self.label.setFont(font) self.label.setStyleSheet("color: white; background-color: black;") self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 2) self.label_2 = QtWidgets.QLabel(self.groupBox) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.label_2.setFont(font) self.label_2.setStyleSheet("color: white; background-color: black;") self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.label_3 = QtWidgets.QLabel(self.groupBox) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.label_3.setFont(font) self.label_3.setStyleSheet( "color: white; background-color: black; border: 0;") self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 1, 1, 1, 1) self.groupBox_3 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_3.setGeometry(QtCore.QRect(440, 10, 321, 211)) self.groupBox_3.setStyleSheet( "color: white; background-color: black; border:0;") self.groupBox_3.setTitle("") self.groupBox_3.setObjectName("groupBox_3") self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox_3) self.gridLayout_3.setObjectName("gridLayout_3") self.label_15 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(48) font.setBold(True) font.setWeight(75) self.label_15.setFont(font) self.label_15.setStyleSheet("color: white; background-color: black;") self.label_15.setObjectName("label_15") self.gridLayout_3.addWidget(self.label_15, 1, 0, 1, 1) self.label_16 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_16.setFont(font) self.label_16.setStyleSheet("color: white; background-color: black;") self.label_16.setObjectName("label_16") self.gridLayout_3.addWidget(self.label_16, 2, 0, 1, 1) self.label_17 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_17.setFont(font) self.label_17.setStyleSheet("color: white; background-color: black;") self.label_17.setObjectName("label_17") self.gridLayout_3.addWidget(self.label_17, 3, 0, 1, 1) self.label_18 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_18.setFont(font) self.label_18.setStyleSheet("color: white; background-color: black;") self.label_18.setObjectName("label_18") self.gridLayout_3.addWidget(self.label_18, 4, 0, 1, 1) self.label_19 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label_19.setFont(font) self.label_19.setStyleSheet("color: white; background-color: black;") self.label_19.setObjectName("label_19") self.gridLayout_3.addWidget(self.label_19, 1, 1, 1, 1) self.label_20 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_20.setFont(font) self.label_20.setStyleSheet("color: white; background-color: black;") self.label_20.setObjectName("label_20") self.gridLayout_3.addWidget(self.label_20, 4, 1, 1, 4) self.label_21 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(22) font.setBold(True) font.setWeight(75) self.label_21.setFont(font) self.label_21.setLayoutDirection(QtCore.Qt.LeftToRight) self.label_21.setStyleSheet("color: white; background-color: black;") self.label_21.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.label_21.setObjectName("label_21") self.gridLayout_3.addWidget(self.label_21, 0, 1, 1, 4) self.label_22 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(26) font.setBold(True) font.setWeight(75) self.label_22.setFont(font) self.label_22.setLayoutDirection(QtCore.Qt.LeftToRight) self.label_22.setStyleSheet("color: white; background-color: black;") self.label_22.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.label_22.setObjectName("label_22") self.gridLayout_3.addWidget(self.label_22, 1, 4, 1, 1) self.label_23 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_23.setFont(font) self.label_23.setStyleSheet("color: white; background-color: black;") self.label_23.setObjectName("label_23") self.gridLayout_3.addWidget(self.label_23, 3, 1, 1, 4) self.label_24 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(16) font.setBold(True) font.setWeight(75) self.label_24.setFont(font) self.label_24.setStyleSheet("color: white; background-color: black;") self.label_24.setObjectName("label_24") self.gridLayout_3.addWidget(self.label_24, 2, 1, 1, 4) self.label_25 = QtWidgets.QLabel(self.groupBox_3) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(48) font.setBold(True) font.setWeight(75) self.label_25.setFont(font) self.label_25.setStyleSheet("color: white; background-color: black;") self.label_25.setObjectName("label_25") self.gridLayout_3.addWidget(self.label_25, 1, 2, 1, 1) self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_2.setGeometry(QtCore.QRect(640, 410, 131, 701)) self.groupBox_2.setStyleSheet("") self.groupBox_2.setObjectName("groupBox_2") self.pushButton = QtWidgets.QPushButton(self.groupBox_2) self.pushButton.setGeometry(QtCore.QRect(30, 30, 80, 80)) self.pushButton.setStyleSheet( "color:black; background-color:white;background-image: url(\"f.png\");" ) self.pushButton.setText("") self.pushButton.setObjectName("pushButton") self.pushButton.clicked.connect(self.wa) self.pushButton_2 = QtWidgets.QPushButton(self.groupBox_2) self.pushButton_2.setGeometry(QtCore.QRect(30, 140, 80, 80)) self.pushButton_2.setStyleSheet( "color:black; background-color:white; background-image: url(\"t.jpg\");" ) self.pushButton_2.setText("") self.pushButton_2.setObjectName("pushButton_2") self.pushButton_3 = QtWidgets.QPushButton(self.groupBox_2) self.pushButton_3.setGeometry(QtCore.QRect(30, 250, 80, 80)) self.pushButton_3.setStyleSheet( "color:black; background-color:white; background-image: url(\"i.png\");" ) self.pushButton_3.setText("") self.pushButton_3.setObjectName("pushButton_3") self.pushButton_4 = QtWidgets.QPushButton(self.groupBox_2) self.pushButton_4.setGeometry(QtCore.QRect(30, 360, 80, 80)) self.pushButton_4.setStyleSheet( "color:black; background-color:white; background-image: url(\"l.jpg\");" ) self.pushButton_4.setText("") self.pushButton_4.setObjectName("pushButton_4") self.pushButton_5 = QtWidgets.QPushButton(self.groupBox_2) self.pushButton_5.setGeometry(QtCore.QRect(30, 470, 80, 80)) self.pushButton_5.setStyleSheet( "color:black; background-color:white; background-image: url(\"g.png\");" ) self.pushButton_5.setText("") self.pushButton_5.setObjectName("pushButton_5") self.pushButton_6 = QtWidgets.QPushButton(self.groupBox_2) self.pushButton_6.setGeometry(QtCore.QRect(30, 580, 80, 80)) self.pushButton_6.setStyleSheet( "color:black; background-color:white; background-image: url(\"y.jpg\");" ) self.pushButton_6.setText("") self.pushButton_6.setObjectName("pushButton_6") self.label_4 = QtWidgets.QLabel(self.centralwidget) self.label_4.setGeometry(QtCore.QRect(220, 1250, 371, 31)) font = QtGui.QFont() font.setPointSize(20) self.label_4.setFont(font) self.label_4.setObjectName("label_4") self.pushButton_7 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_7.setGeometry(QtCore.QRect(730, 1130, 40, 40)) self.pushButton_7.setStyleSheet("background-image:url(\"w.png\");") self.pushButton_7.setText("") self.pushButton_7.setObjectName("pushButton_7") self.webView = QtWebKitWidgets.QWebView(self.centralwidget) self.webView.setGeometry(QtCore.QRect(20, 440, 591, 331)) self.webView.setUrl(QtCore.QUrl("about:blank")) self.webView.setObjectName("webView") self.groupBox_4 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_4.setGeometry(QtCore.QRect(0, 220, 281, 61)) self.groupBox_4.setTitle("") self.groupBox_4.setObjectName("groupBox_4") self.dial = QtWidgets.QDial(self.centralwidget) self.dial.setGeometry(QtCore.QRect(650, 290, 111, 101)) self.dial.setStyleSheet("color: white; background-color:white;") self.dial.setObjectName("dial") self.webView_2 = QtWebKitWidgets.QWebView(self.centralwidget) self.webView_2.setGeometry(QtCore.QRect(20, 790, 591, 331)) self.webView_2.setUrl(QtCore.QUrl("about:blank")) self.webView_2.setObjectName("webView_2") self.lcdNumber = QtWidgets.QLCDNumber(self.centralwidget) self.lcdNumber.setGeometry(QtCore.QRect(480, 310, 171, 71)) font = QtGui.QFont() font.setPointSize(25) self.lcdNumber.setFont(font) self.lcdNumber.setObjectName("lcdNumber") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) self.dial.valueChanged['int'].connect(self.lcdNumber.display) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1366, 800) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget) self.textBrowser.setGeometry(QtCore.QRect(10, 570, 1341, 201)) self.textBrowser.setObjectName("textBrowser") self.groupBox = QtWidgets.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(10, 60, 371, 215)) self.groupBox.setObjectName("groupBox") self.pushButton = QtWidgets.QPushButton(self.groupBox) self.pushButton.setGeometry(QtCore.QRect(10, 30, 351, 23)) self.pushButton.setObjectName("pushButton") self.pushButton_3 = QtWidgets.QPushButton(self.groupBox) self.pushButton_3.setGeometry(QtCore.QRect(10, 60, 351, 23)) self.pushButton_3.setObjectName("pushButton_3") self.pushButton_4 = QtWidgets.QPushButton(self.groupBox) self.pushButton_4.setGeometry(QtCore.QRect(10, 90, 351, 23)) self.pushButton_4.setObjectName("pushButton_4") self.pushButton_5 = QtWidgets.QPushButton(self.groupBox) self.pushButton_5.setGeometry(QtCore.QRect(10, 120, 351, 23)) self.pushButton_5.setObjectName("pushButton_5") self.pushButton_6 = QtWidgets.QPushButton(self.groupBox) self.pushButton_6.setGeometry(QtCore.QRect(10, 150, 351, 23)) self.pushButton_6.setObjectName("pushButton_6") self.pushButton_8 = QtWidgets.QPushButton(self.groupBox) self.pushButton_8.setGeometry(QtCore.QRect(180, 180, 181, 23)) self.pushButton_8.setObjectName("pushButton_8") self.pushButton_7 = QtWidgets.QPushButton(self.groupBox) self.pushButton_7.setGeometry(QtCore.QRect(10, 180, 171, 23)) self.pushButton_7.setObjectName("pushButton_7") self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_2.setGeometry(QtCore.QRect(390, 10, 965, 551)) self.groupBox_2.setObjectName("groupBox_2") self.widget = QtWebKitWidgets.QWebView(self.groupBox_2) self.widget.setGeometry(QtCore.QRect(10, 30, 945, 521)) self.widget.setObjectName("widget") self.groupBox_3 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_3.setGeometry(QtCore.QRect(10, 10, 371, 61)) self.groupBox_3.setObjectName("groupBox_3") self.pushButton_2 = QtWidgets.QPushButton(self.groupBox_3) self.pushButton_2.setGeometry(QtCore.QRect(290, 30, 75, 23)) self.pushButton_2.setObjectName("pushButton_2") self.lineEdit = QtWidgets.QLineEdit(self.groupBox_3) self.lineEdit.setGeometry(QtCore.QRect(10, 30, 271, 25)) self.lineEdit.setObjectName("lineEdit") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(10, 550, 46, 13)) self.label.setObjectName("label") self.pushButton_9 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_9.setGeometry(QtCore.QRect(160, 300, 71, 23)) self.pushButton_9.setObjectName("pushButton_9") self.groupBox_3.raise_() self.groupBox_2.raise_() self.groupBox.raise_() self.textBrowser.raise_() self.label.raise_() self.pushButton_9.raise_() self.pushButton.setEnabled(False) self.pushButton_3.setEnabled(False) self.pushButton_4.setEnabled(False) self.pushButton_5.setEnabled(False) self.pushButton_6.setEnabled(False) MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) self.pushButton_2.clicked.connect(self.load_db) self.pushButton.clicked.connect(self.list_with_most_attacks) self.pushButton_3.clicked.connect(self.visualize_with_most_attacks) self.pushButton_4.clicked.connect(self.list_with_most_casualties) self.pushButton_5.clicked.connect(self.list_by_dates) self.pushButton_6.clicked.connect(self.visualize_by_dates) self.pushButton_7.clicked.connect(self.visualize_word_cloud) self.pushButton_8.clicked.connect(self.visualize_world_map) self.pushButton_9.clicked.connect(self.close_app)
def __init__(self, parent=None): """Constructor; initialise fields, load bookmarks and construct GUI.""" QtWidgets.QDialog.__init__(self, parent) settings = QtCore.QSettings() settings.setIniCodec(QtCore.QTextCodec.codecForName("UTF-8")) # load timezone info and bookmarks self.tz = FPPTimezone() self.tz.loadTimezoneDB() self.bookmarks = FPPGeoBookmarks() try: self.bookmarks.loadList( [str(i) for i in settings.value("LocationBookmarks", [])]) except: pass # prepare progressbar (webpage loading progress) and webview self.progressbar = QtWidgets.QProgressBar() self.webview = QtWebKitWidgets.QWebView() # construct bookmark sidebar (bookmark list, add and delete button) self.list_locations = QtWidgets.QListWidget() for name, location in self.bookmarks.listLocations(): item = QtWidgets.QListWidgetItem() item.setText(name) item.setToolTip("{0:9.4f}, {1:9.4f}".format(*location)) self.list_locations.addItem(item) self.button_add = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Add...")) self.button_add.setEnabled(False) self.button_add.setDisabled(True) self.button_del = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Delete")) self.button_del.setEnabled(False) self.button_del.setDisabled(True) layout_locbut = QtWidgets.QHBoxLayout() layout_locbut.addWidget(self.button_add) layout_locbut.addWidget(self.button_del) # construct controls for coordinates: lat/lon spinboxes, goto button button_goto = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Go to")) button_goto.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) self.spin_latitude = QtWidgets.QDoubleSpinBox() self.spin_latitude.setSizePolicy( QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) self.spin_latitude.setRange(-84.99999999, 85) self.spin_latitude.setDecimals(8) self.spin_latitude.setSuffix(" °") self.spin_latitude.setSingleStep(1) self.spin_latitude.setWrapping(True) self.spin_longitude = QtWidgets.QDoubleSpinBox() self.spin_longitude.setSizePolicy( QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) self.spin_longitude.setRange(-179.99999999, 180) self.spin_longitude.setDecimals(8) self.spin_longitude.setSuffix(" °") self.spin_longitude.setSingleStep(1) self.spin_longitude.setWrapping(True) layout_latlon = QtWidgets.QFormLayout() layout_latlon.addRow( QtWidgets.QLabel( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Latitude:")), self.spin_latitude) layout_latlon.addRow( QtWidgets.QLabel( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Longitude:")), self.spin_longitude) # arrange widgets for sidebar and coordinates control layout_coord = QtWidgets.QHBoxLayout() layout_coord.addLayout(layout_latlon) layout_coord.addWidget(button_goto) layout_coord.setAlignment(QtCore.Qt.AlignTop) self.edit_search = QtWidgets.QLineEdit() button_search = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Find")) layout_search = QtWidgets.QHBoxLayout() layout_search.addWidget(self.edit_search) layout_search.addWidget(button_search) layout_locations = QtWidgets.QVBoxLayout() layout_locations.addLayout(layout_search) layout_locations.addWidget(self.list_locations) layout_locations.addLayout(layout_locbut) layout_locations.addLayout(layout_coord) locations = QtWidgets.QWidget() locations.setLayout(layout_locations) # create standard dialog buttons (ok/cancel) button_ok = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "OK")) button_cancel = QtWidgets.QPushButton( QtCore.QCoreApplication.translate("GeoLookUpDialog", "Cancel")) layout_buttons = QtWidgets.QHBoxLayout() layout_buttons.addStretch(1) layout_buttons.addWidget(button_ok) layout_buttons.addWidget(button_cancel) # integrate sidebar, controls, webpage and buttons into a central splitter layout_webview = QtWidgets.QVBoxLayout() layout_webview.addWidget(self.webview) layout_webview.addLayout(layout_buttons) webview = QtWidgets.QWidget() webview.setLayout(layout_webview) splitter = QtWidgets.QSplitter() splitter.setOrientation(QtCore.Qt.Horizontal) splitter.addWidget(locations) splitter.addWidget(webview) layout_central = QtWidgets.QVBoxLayout() layout_central.addWidget(self.progressbar) layout_central.addWidget(splitter) # wiring: connect widgets to methods self.webview.page().mainFrame().javaScriptWindowObjectCleared.connect( self.populateJavaScriptWindowObject) # self.connect( # self.webview.page().mainFrame(), # QtCore.SIGNAL('javaScriptWindowObjectCleared()'), # self.populateJavaScriptWindowObject # ) self.webview.loadStarted.connect(self.webViewLoadStarted) # self.connect( # self.webview, # QtCore.SIGNAL('loadStarted()'), # self.webViewLoadStarted # ) self.webview.loadProgress.connect(self.webViewLoadProgress) # self.connect( # self.webview, # QtCore.SIGNAL('loadProgress(int)'), # self.webViewLoadProgress # ) self.webview.loadFinished.connect(self.webViewLoadFinished) # self.connect( # self.webview, # QtCore.SIGNAL('loadFinished(bool)'), # self.webViewLoadFinished # ) button_ok.clicked.connect(self.accept) # self.connect( # button_ok, # QtCore.SIGNAL('clicked()'), # self.accept # ) button_cancel.clicked.connect(self.reject) # self.connect( # button_cancel, # QtCore.SIGNAL('clicked()'), # self.reject # ) self.finished.connect(self.writeLocationsToSettings) # self.connect( # self, # QtCore.SIGNAL('finished(int)'), # self.writeLocationsToSettings # ) button_search.clicked.connect(self.searchLocation) # self.connect( # button_search, # QtCore.SIGNAL('clicked()'), # self.searchLocation # ) self.button_add.clicked.connect(self.addLocation) # self.connect( # self.button_add, # QtCore.SIGNAL('clicked()'), # self.addLocation # ) self.button_del.clicked.connect(self.deleteLocation) # self.connect( # self.button_del, # QtCore.SIGNAL('clicked()'), # self.deleteLocation # ) self.list_locations.itemSelectionChanged.connect(self.selectionChanged) # self.connect( # self.list_locations, # QtCore.SIGNAL('itemSelectionChanged()'), # self.selectionChanged # ) self.list_locations.itemDoubleClicked.connect(self.loadLocation) # self.connect( # self.list_locations, # QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem*)'), # self.loadLocation # ) self.spin_latitude.valueChanged.connect(self.setMarkerAndGoTo) # self.connect( # self.spin_latitude, # QtCore.SIGNAL('valueChanged(double)'), # self.setMarkerAndGoTo # ) self.spin_longitude.valueChanged.connect(self.setMarkerAndGoTo) # self.connect( # self.spin_longitude, # QtCore.SIGNAL('valueChanged(double)'), # self.setMarkerAndGoTo # ) button_goto.clicked.connect(self.setMarkerAndGoTo) # self.connect( # button_goto, # QtCore.SIGNAL('clicked()'), # self.setMarkerAndGoTo # ) # start dialog by setting central layout and loading custom OSM page self.setLayout(layout_central) with open(os.path.join(sys.path[0], "FotoPreProcessorOSM.html"), "r") as f: self.webview.setHtml(f.read()) self.webview.show()