Esempio n. 1
0
 def _build_ui(self):
     from chimerax.ui.widgets.tabbedtoolbar import TabbedToolbar
     from PyQt5.QtWidgets import QVBoxLayout
     layout = QVBoxLayout()
     margins = layout.contentsMargins()
     margins.setTop(0)
     margins.setBottom(0)
     layout.setContentsMargins(margins)
     self.ttb = TabbedToolbar(
         self.tool_window.ui_area, show_section_titles=_settings.show_section_labels,
         show_button_titles=_settings.show_button_labels)
     layout.addWidget(self.ttb)
     self._build_tabs()
     self.tool_window.ui_area.setLayout(layout)
     self.tool_window.manage(self.PLACEMENT)
Esempio n. 2
0
class PagedDialog(QDialog):

    def __init__(self, theParent=None):
        QDialog.__init__(self, parent=theParent)

        self._outerBox  = QVBoxLayout()
        self._buttonBox = QHBoxLayout()
        self._tabBox    = QTabWidget()

        self._tabBar = VerticalTabBar(self)
        self._tabBox.setTabBar(self._tabBar)
        self._tabBox.setTabPosition(QTabWidget.West)
        self._tabBar.setExpanding(False)

        self._outerBox.addWidget(self._tabBox)
        self._outerBox.addLayout(self._buttonBox)
        self.setLayout(self._outerBox)

        # Default Margins
        qM = self._outerBox.contentsMargins()
        mL = qM.left()
        mR = qM.right()
        mT = qM.top()
        mB = qM.bottom()

        self.setContentsMargins(0, 0, 0, 0)
        self._outerBox.setContentsMargins(0, 0, 0, mB)
        self._buttonBox.setContentsMargins(mL, 0, mR, 0)
        self._outerBox.setSpacing(mT)

        return

    def addTab(self, tabWidget, tabLabel):
        """Forwards the adding of tabs to the QTabWidget.
        """
        self._tabBox.addTab(tabWidget, tabLabel)
        return

    def addControls(self, buttonBar):
        """Adds a button bar to the dialog.
        """
        self._buttonBox.addWidget(buttonBar)
        return
Esempio n. 3
0
class EventDialog(QDialog, FORM_CLASS):

    # Editable layer to alter edition mode (transaction group).
    editableLayerObject = None

    # Replay is not enabled.
    replayEnabled = False

    #
    # Internal.
    #
    catchLayerModifications = True

    def __init__(self,
                 parent,
                 connection_wrapper_read,
                 connection_wrapper_write,
                 map_canvas,
                 audit_table,
                 replay_function=None,
                 table_map={},
                 selected_layer_id=None,
                 selected_feature_id=None):
        """Constructor.
        @param parent parent widget
        @param connection_wrapper_read connection wrapper (dbapi2)
        @param connection_wrapper_write connection wrapper (dbapi2 or transaction group)
        @param map_canvas the main QgsMapCanvas
        @param audit_table the name of the audit table in the database
        @param replay_function name of the replay function in the database
        @param table_map a dict that associates database table name to a QGIS layer id layer_id : table_name
        @param selected_layer_id selected layer
        @param selected_feature_id selected feature_id
        """
        super(EventDialog, self).__init__(parent)
        # Set up the user interface from Designer.
        # After setupUI you can access any designer object by doing
        # self.<objectname>, and you can use autoconnect slots - see
        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
        # #widgets-and-dialogs-with-auto-connect
        self.setupUi(self)

        # reload button icons
        self.searchButton.setIcon(
            QIcon(
                os.path.join(os.path.dirname(__file__), 'icons',
                             'mActionFilter2.svg')))
        self.replayButton.setIcon(
            QIcon(
                os.path.join(os.path.dirname(__file__), 'icons',
                             'mIconWarn.png')))

        # Store connections.
        self.connection_wrapper_read = connection_wrapper_read
        self.connection_wrapper_write = connection_wrapper_write

        self.map_canvas = map_canvas
        self.audit_table = audit_table
        self.replay_function = replay_function

        # Watch for layer added or removed for replay button state update.
        QgsProject.instance().layersRemoved.connect(
            self.updateReplayButtonState)
        QgsProject.instance().layersAdded.connect(self.updateReplayButtonState)

        # Register all current layers.
        self.updateReplayButtonState()

        # geometry columns : table_name => list of geometry columns, the first one is the "main" geometry column
        self.geometry_columns = {}

        self.table_map = table_map

        # populate layer combo
        layer_idx = None
        for i, layer_id in enumerate(self.table_map.keys()):
            l = QgsProject.instance().mapLayer(layer_id)
            if l is None:
                continue
            print(layer_id, selected_layer_id)
            if layer_id == selected_layer_id:
                layer_idx = i + 1
            self.layerCombo.addItem(l.name(), layer_id)
        if layer_idx is not None:
            self.layerCombo.setCurrentIndex(layer_idx)

        if selected_feature_id is not None:
            self.idEdit.setEnabled(True)
            self.idEdit.setText(str(selected_feature_id))

        self.dataTable.hide()

        #
        # inner canvas
        self.vbox = QVBoxLayout()
        margins = self.vbox.contentsMargins()
        margins.setBottom(0)
        margins.setTop(11)
        margins.setLeft(0)
        margins.setRight(0)
        self.vbox.setContentsMargins(margins)
        self.inner_canvas = QgsMapCanvas()
        # copy layer set
        self.inner_canvas.setLayers(self.map_canvas.layers())
        self.inner_canvas.setExtent(self.map_canvas.extent())
        self.geometryGroup.setLayout(self.vbox)
        self.geometryGroup.hide()

        self.hsplitter.setSizes([100, 100])

        self.displayer = GeometryDisplayer(self.map_canvas)
        self.inner_displayer = GeometryDisplayer(self.inner_canvas)

        self.afterDt.setDateTime(QDateTime.currentDateTime())
        self.beforeDt.setDateTime(QDateTime.currentDateTime())

        self.advancedGroup.setCollapsed(True)

        # Old/new geometry legend.
        self.hbox = QHBoxLayout()

        self.oldGeometryLabel = QLabel()
        self.oldGeometryLabel.setText("------- old geometry")
        self.oldGeometryLabel.setStyleSheet(
            "color: " + self.displayer.oldGeometryColor().name())

        self.newGeometryLabel = QLabel()
        self.newGeometryLabel.setText(
            "------- new geometry (will be restored when replaying event)")
        self.newGeometryLabel.setStyleSheet(
            "color: " + self.displayer.newGeometryColor().name())

        self.hbox.addWidget(self.oldGeometryLabel)
        self.hbox.addWidget(self.newGeometryLabel)
        self.hbox.addItem(
            QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Fixed))

        self.vbox.addLayout(self.hbox)
        self.vbox.addWidget(self.inner_canvas)

        # refresh results when the search button is clicked
        self.searchButton.clicked.connect(self.populate)

        # update the feature id line edit visiblity based on the current layer selection
        self.layerCombo.currentIndexChanged.connect(self.onCurrentLayerChanged)

        # replay button
        if self.replay_function:
            self.replayButton.clicked.connect(self.onReplayEvent)

    def onCurrentLayerChanged(self, index):
        self.idEdit.setEnabled(index > 0)

    def done(self, status):
        self.undisplayGeometry()
        return QDialog.done(self, status)

    def populate(self):
        from qgis.core import QgsMessageLog
        wheres = []

        # filter by selected layer/table
        index = self.layerCombo.currentIndex()
        if index > 0:
            lid = self.layerCombo.itemData(index)
            schema, table = self.table_map[lid].split(".")
            wheres.append("schema_name = '{}'".format(schema))
            wheres.append("table_name = '{}'".format(table))

            # filter by feature id, if any
            if len(self.idEdit.text()) > 0:
                try:
                    id = int(self.idEdit.text())
                    wheres.append("row_data->'id'='{}'".format(id))
                except ValueError:
                    pass

        # filter by data
        if self.dataChck.isChecked():
            v = self.dataEdit.text()
            v = v.replace('\\', '\\\\').replace("'", "''").replace(
                '%', '\\%').replace('_', '\\_')
            wheres.append(
                "(SELECT string_agg(v,' ') FROM svals(row_data) as v) ILIKE '%{}%'"
                .format(v))

        # filter by event type
        types = []
        if self.insertsChck.isChecked():
            types.append('I')
        if self.updatesChck.isChecked():
            types.append('U')
        if self.deletesChck.isChecked():
            types.append('D')
        wheres.append("action IN ('{}')".format("','".join(types)))

        # filter by dates
        if self.afterChck.isChecked():
            dt = self.afterDt.dateTime()
            wheres.append("action_tstamp_clk > '{}'".format(
                dt.toString(Qt.ISODate)))
        if self.beforeChck.isChecked():
            dt = self.beforeDt.dateTime()
            wheres.append("action_tstamp_clk < '{}'".format(
                dt.toString(Qt.ISODate)))

        # base query
        q = "SELECT event_id, action_tstamp_clk, schema_name || '.' || table_name, action, application_name, session_user_name, row_data, changed_fields FROM {} l".format(
            self.audit_table)
        # where clause
        if len(wheres) > 0:
            q += " WHERE " + " AND ".join(wheres)

        # Descending order.
        q += " ORDER BY action_tstamp_clk DESC"

        # Create cursor.
        cur = self.connection_wrapper_read.cursor()
        if cur == None:
            print("Cannot get cursor for database.")
            return

        cur.execute(q)

        self.eventModel = EventModel(cur)
        self.eventTable.setModel(self.eventModel)

        self.eventTable.selectionModel().currentRowChanged.connect(
            self.onEventSelection)

        self.eventTable.horizontalHeader().setSectionResizeMode(
            QHeaderView.Interactive)

    def updateReplayButton(self):
        self.replayButton.setEnabled(False)
        self.replayButton.setToolTip(
            "No replay function or layer is in edition mode: replay action is not available."
        )

        if self.replay_function and self.replayEnabled == True:
            self.replayButton.setEnabled(True)
            self.replayButton.setToolTip("Replay the current selected item.")

    def onEventSelection(self, current_idx, previous_idx):
        reset_table_widget(self.dataTable)
        self.undisplayGeometry()

        # get current selection
        if current_idx.row() == -1:
            self.dataTable.hide()
            return
        i = current_idx.row()
        # action from current selection
        action = self.eventModel.data(self.eventModel.index(i, 2), Qt.UserRole)

        self.updateReplayButton()

        # get geometry columns
        data = self.eventModel.row_data(i)
        table_name = self.eventModel.data(self.eventModel.index(i, 1))
        gcolumns = self.geometry_columns.get(table_name)
        if gcolumns is None:
            schema, table = table_name.split('.')

            # Create cursor.
            cur = self.connection_wrapper_read.cursor()
            if cur == None:
                print("Cursor creation has failed")
                return

            q = "SELECT f_geometry_column FROM geometry_columns WHERE f_table_schema='{}' AND f_table_name='{}'".format(
                schema, table)
            cur.execute(q)
            self.geometry_columns[table_name] = [r[0] for r in cur.fetchall()]
            gcolumns = self.geometry_columns[table_name]

        # insertion or deletion
        if action == 'I' or action == 'D':
            self.dataTable.setColumnCount(2)
            self.dataTable.setHorizontalHeaderLabels(["Column", "Value"])
            j = 0
            for k, v in data.items():
                if len(gcolumns) > 0 and k == gcolumns[0]:
                    self.displayGeometry(ewkb_to_geom(v))
                    continue
                if k in gcolumns:
                    continue
                if v is None:
                    continue
                self.dataTable.insertRow(j)
                self.dataTable.setItem(j, 0, QTableWidgetItem(k))
                self.dataTable.setItem(j, 1, QTableWidgetItem(v))
                j += 1
        # update
        elif action == 'U':
            self.dataTable.setColumnCount(3)
            self.dataTable.setHorizontalHeaderLabels(
                ["Column", "Old value", "New value"])
            changed_fields = self.eventModel.changed_fields(i)
            j = 0
            for k, v in data.items():
                if len(gcolumns) > 0 and k == gcolumns[0]:
                    w = changed_fields.get(k)
                    if w is not None:
                        self.displayGeometry(ewkb_to_geom(v), ewkb_to_geom(w))
                    continue
                if k in gcolumns:
                    continue
                w = changed_fields.get(k)
                if v is None and w is None:
                    continue
                self.dataTable.insertRow(j)
                self.dataTable.setItem(j, 0, QTableWidgetItem(k))
                self.dataTable.setItem(j, 1, QTableWidgetItem(v))
                if w is None:
                    self.dataTable.setItem(j, 2, QTableWidgetItem(v))
                else:
                    self.dataTable.setItem(j, 2, QTableWidgetItem(w))
                    if v != w:
                        b = QBrush(QColor("#ff8888"))
                        self.dataTable.item(j, 0).setBackground(b)
                        self.dataTable.item(j, 1).setBackground(b)
                        self.dataTable.item(j, 2).setBackground(b)
                j += 1
        self.dataTable.resizeColumnsToContents()
        #self.dataTable.sortByColumn(0, Qt.DescendingOrder)
        self.dataTable.show()

    def undisplayGeometry(self):
        self.geometryGroup.hide()
        self.displayer.reset()
        self.inner_displayer.reset()

    def displayGeometry(self, geom, geom2=None):
        self.inner_displayer.display(geom, geom2)
        self.geometryGroup.show()

        if self.onMainCanvas.isChecked():
            self.displayer.display(geom, geom2)

    def onReplayEvent(self):
        i = self.eventTable.selectionModel().currentIndex().row()
        if i == -1:
            return
        # event_id from current selection
        event_id = self.eventModel.data(self.eventModel.index(i, 0),
                                        Qt.UserRole)

        error = ""

        q = "SELECT {}({})".format(self.replay_function, event_id)

        # Make a layer using transaction group editable to allow Sql execution.
        self.catchLayerModifications = False
        if self.editableLayerObject != None:
            self.editableLayerObject.startEditing()

        error = self.connection_wrapper_write.executeSql(q)

        if self.editableLayerObject != None:
            self.editableLayerObject.commitChanges()

        self.catchLayerModifications = True

        if error != "":
            self.error_dlg = ErrorDialog(self)
            self.error_dlg.setErrorText(
                "An error has occurred during database access.")
            self.error_dlg.setContextText(error)
            self.error_dlg.setDetailsText("")
            self.error_dlg.exec_()

        self.connection_wrapper_write.commit()

        # refresh table
        self.populate()

        # Refresh replay button state.
        self.updateReplayButtonState()

    # Check if provided layer database connection is identical as current connection.
    def isLayerDatabaseCurrentConnection(self, layer):
        source = layer.source()

        layerUri = QgsDataSourceUri(source)
        pluginuri = QgsDataSourceUri(self.connection_wrapper_read.db_source)

        return self.areConnectionsEquals(layerUri, pluginuri)

    # Compare connections.
    def areConnectionsEquals(self, connection1, connection2):

        # Service id defined: compare service & Ssl mode.
        service = connection1.service() + connection2.service()
        if service != "":
            if connection1.service() != connection2.service():
                return False

            if connection1.sslMode() != connection2.sslMode():
                return False

            # Connections are equals.
            return True

        # No service: compare host, port & database.
        if connection1.host() != connection2.host():
            return False

        if connection1.port() != connection2.port():
            return False

        if connection1.database() != connection2.database():
            return False

        # Connections are equals.
        return True

    # Reload replay button state by checking layer edition mode.
    def updateReplayButtonState(self, unused):
        self.updateReplayButtonState()

    def layerEditionModeChanged(self):
        self.updateReplayButtonState()

    def updateReplayButtonState(self):

        if self.catchLayerModifications == False:
            return

        self.editableLayerObject = None

        # Get all layers.
        layers = QgsProject.instance().mapLayers()

        self.replayEnabled = True

        for lid, layer in layers.items():

            # Check for layer using same database connection.
            usingSameDb = self.isLayerDatabaseCurrentConnection(layer)

            # Layer is in edition mode:
            if layer.isEditable() == True:

                # Check for database connection.
                if usingSameDb == True:
                    # Disable replay button.
                    self.replayEnabled = False

            # Layer is not editable: candidate for layer storage.
            # Store a layer that uses this connection.
            else:
                if usingSameDb == True:
                    self.editableLayerObject = layer

            # Watch layer edition mode changes.
            if getattr(layer,
                       "beforeEditingStarted", None) != None and getattr(
                           layer, "editingStopped", None) != None:
                try:
                    layer.editingStarted.connect(self.layerEditionModeChanged,
                                                 Qt.UniqueConnection)
                    layer.editingStopped.connect(self.layerEditionModeChanged,
                                                 Qt.UniqueConnection)
                except:
                    pass

        self.updateReplayButton()
Esempio n. 4
0
class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.graph =PlotCanvas3d(self, width=1, height=1)
        self.graph_2 = PlotCanvas(self, width=1, height=1)
        f = open('style.css', 'r')

        self.setStyleSheet(f.read())
        f.close()
        login = LoginWindow(self)
        self.createGui()

    def createGui(self):
        self.setGeometry(10, 30, 600, 300)
        self.setWindowTitle("Test")
        self.tabs = QTabWidget()
        self.tab = QWidget()
        self.tab_result = QWidget()
        self.tabs.addTab(self.tab, "Главное")
        self.tabs.addTab(self.tab_result, "Таблица значений")
        # self.tab = QTabWidget()
        # self.tab.addTab(self, "Главное окно")
        self.tools_panel = QVBoxLayout()
        self.lab_method = QLabel("Метод оптимизации")
        self.lab_method.setAlignment(Qt.AlignCenter)
        self.select_method = QComboBox()
        self.select_method.addItem("Полный перебор")
        self.select_method.addItem("Сканнирование с переменным шагом")
        self.lab_var = QLabel("Вариант")
        self.lab_var.setAlignment(Qt.AlignCenter)
        self.select_var = QComboBox()
        self.select_var.addItem("11")
        self.lab_select_temterature = QLabel("Ограничения температуры")
        self.temp_layout = QHBoxLayout()
        self.temp_layout_2 = QHBoxLayout()
        self.lab_T1min = QLabel("Tmin")
        self.lab_T1max = QLabel("Tmax")
        self.lab_T2min = QLabel("T2min")
        self.lab_T2max = QLabel("T2max")
        self.T2min = QLineEdit()
        self.T2min.setText("-0.5")
        self.T2max = QLineEdit()
        self.T2max.setText("3")
        self.value_T1 = QLineEdit()
        self.value_T1.setText("-3")
        self.value_T2 = QLineEdit()
        self.value_T2.setText("0.5")
        self.temp_layout.addWidget(self.lab_T1min)
        self.temp_layout.addWidget(self.value_T1)
        self.temp_layout.addWidget(self.lab_T1max)
        self.temp_layout.addWidget(self.value_T2)
        self.temp_layout_2.addWidget(self.lab_T2min)
        self.temp_layout_2.addWidget(self.T2min)
        self.temp_layout_2.addWidget(self.lab_T2max)
        self.temp_layout_2.addWidget(self.T2max)

        self.lim_layout = QHBoxLayout()
        self.lim_layout_2 = QHBoxLayout()
        self.lab_lim = QLabel("Ограничения 2-го рода:")
        self.lim_value = QLineEdit()
        self.lab_count = QLabel("Кол-во устройств:")
        self.count = QLineEdit()
        self.lim_value.setText("T2-T1 <= 3")
        self.lim_value.setEnabled(False)
        self.count.setText("2")
        self.count.setEnabled(False)
        self.lim_layout.addWidget(self.lim_value)
        self.lim_layout.addWidget(self.count)
        self.lim_layout_2.addWidget(self.lab_lim)
        self.lim_layout_2.addWidget(self.lab_count)


        self.lab_accuracy = QLabel("Точность нахождения решения:")
        self.accuracy = QLineEdit()
        self.accuracy.setText("0.01")


        self.lab_mult = QLabel("Нормирующие множители:")
        self.mult_layout_1 = QHBoxLayout()
        self.lab_alfa = QLabel("\u03B1")
        self.alfa = QLineEdit()
        self.alfa.setText("1")
        self.lab_beta = QLabel("\u03B2")
        self.beta = QLineEdit()
        self.beta.setText("1")
        self.lab_y = QLabel("y")
        self.y = QLineEdit()
        self.y.setText("3.14")
        self.mult_layout_1.addWidget(self.lab_alfa)
        self.mult_layout_1.addWidget(self.alfa)
        self.mult_layout_1.addWidget(self.lab_beta)
        self.mult_layout_1.addWidget(self.beta)
        self.mult_layout_1.addWidget(self.lab_y)
        self.mult_layout_1.addWidget(self.y)


        self.lab_volume = QLabel("Величина перепада давлений Кпа:")
        self.lab_P1 = QLabel("\u0394 P1")
        self.lab_P2 = QLabel("\u0394 P2")
        self.P1 = QLineEdit()
        self.P1.setText("1")
        self.P2 = QLineEdit()
        self.P2.setText("1")
        self.volume_layout = QHBoxLayout()
        self.volume_layout.addWidget(self.lab_P1)
        self.volume_layout.addWidget(self.P1)
        self.volume_layout.addWidget(self.lab_P2)
        self.volume_layout.addWidget(self.P2)

        self.tools_panel.contentsMargins().top()
        self.tools_panel.addWidget(self.lab_method)
        self.tools_panel.addWidget(self.select_method)
        self.tools_panel.addWidget(self.lab_var)
        self.tools_panel.addWidget(self.select_var)
        self.tools_panel.addWidget(self.lab_select_temterature)
        self.tools_panel.addLayout(self.temp_layout)
        self.tools_panel.addLayout(self.temp_layout_2)
        self.tools_panel.addLayout(self.lim_layout_2)
        self.tools_panel.addLayout(self.lim_layout)
        self.tools_panel.addWidget(self.lab_accuracy)
        self.tools_panel.addWidget(self.accuracy)
        self.tools_panel.addWidget(self.lab_mult)
        self.tools_panel.addLayout(self.mult_layout_1)

        self.tools_panel.addWidget(self.lab_volume)
        self.tools_panel.addLayout(self.volume_layout)
        self.tools_panel.addStretch(1)

        self.result_layout = QHBoxLayout()
        self.result_line = QLineEdit()
        self.result_line.setEnabled(False)
        self.result_line.setMinimumSize(200, 30)
        self.result_lab = QLabel("Результат: ")
        self.result_lab.setFont(QFont('', 10))
        self.result_layout.addWidget(self.result_lab)
        self.result_layout.addWidget(self.result_line)

        self.layout = QGridLayout()
        self.layout.addLayout(self.tools_panel, 0, 1)

        self.buttons_panel = QHBoxLayout()
        self.start_button = QPushButton('Решить задачу')
        self.start_button.clicked.connect(self.plotGraph)
        self.buttons_panel.addWidget(self.start_button)

        self.name_graph = QLabel("3-D График критерия качества оптимизации")
        self.name_graph.setAlignment(Qt.AlignCenter)
        self.graph_layout = QVBoxLayout()

        self.graph_layout.addWidget(self.name_graph)
        self.graph_layout.addWidget(self.graph)

        self.third_graph_lay = QVBoxLayout()
        self.lab_tihrd_graph = QLabel("Контурный график критерия качества оптимизации")
        self.lab_tihrd_graph.setAlignment(Qt.AlignCenter)
        self.third_graph = gl.GLViewWidget()
        self.third_graph.setGeometry(0, 110, 1920, 500)
        self.third_graph_lay.addWidget(self.lab_tihrd_graph)
        self.third_graph_lay.addWidget(self.graph_2)

        self.graph_layout.addLayout(self.third_graph_lay)
        self.layout.addLayout(self.graph_layout, 2, 1)
        self.layout.addLayout(self.result_layout, 1, 1)
        self.layout.addLayout(self.buttons_panel, 3, 1)

        # self.layout.addLayout(self.buttons_panel, 1,1)
        # self.tab.addTab(self, "Tab")
        self.table = QTableWidget()
        self.table.setColumnCount(2000)
        self.table.setRowCount(2000)
        self.table_layout = QVBoxLayout()
        self.table_layout.addWidget(self.table)
        self.tab_result.setLayout(self.table_layout)

        self.tab.setLayout(self.layout)
        self.lay_tab_1 = QVBoxLayout()
        self.lay_tab_1.addWidget(self.tabs)
        self.setLayout(self.lay_tab_1)
        # self.setLayout(self.layout)
        self.setAcceptDrops(True)
        #self.show()

    def dragEnterEvent(self, e):
        e.accept()

    def dropEvent(self, e):
        position = e.pos()
        self.button.move(position)
        e.setDropAction(Qt.MoveAction)
        e.accept()
    def plotGraph(self):
        print("plot")
        T_min = float(self.value_T1.text())
        T_max = float(self.value_T2.text())
        print("qwe")
        accuracy =float(self.accuracy.text())
        a = float(self.alfa.text())
        b = float(self.beta.text())
        y = float(self.y.text())
        print("asd")
        P1 = float(self.P1.text())
        P2 = float(self.P2.text())
        print(a, b, y, P1, P2)
        h = Handler(a, b, y, P1, P2)
        self.result_line.setText(h.full(T_min, T_max, T_min, T_max, accuracy))
        self.graph.plot(h.xgrid, h.ygrid, h.zgrid)
        self.graph_2.plot(h.xgrid, h.ygrid, h.zgrid)
        self.update_table(h.xgrid, h.ygrid, h.arr_d)
    def update_table(self, arr1, arr2, arr3):
        for x in range(len(arr1)):
            for y in range(len(arr2)):
                self.table.setItem(x, y, QTableWidgetItem(str(arr3[x][y])))