Exemple #1
0
    def __init__(self, p, top):
        super().__init__(p)
        self.top = top
        self.choose_color = config['color']
        self.setProperty('class', 'set')
        layer = qt.QVBoxLayout()

        self.server_cfg = qt.QFrame(self)
        layer_1 = CommonHBox()
        layer_1.addWidget(qt.QLabel('服务器', self.server_cfg))
        self.server_input = qt.QLineEdit(config['server'], self.server_cfg)
        layer_1.addWidget(self.server_input)
        self.server_cfg.setLayout(layer_1)

        self.color_cfg = qt.QFrame(self)
        layer_2 = CommonHBox()
        layer_2.addWidget(qt.QLabel('主题', self.server_cfg))
        self.white = qt.QPushButton(self.color_cfg)
        self.white.clicked.connect(self.set_white)
        self.white.setProperty('class', 'white')
        self.dracula = qt.QPushButton(self.color_cfg)
        self.dracula.clicked.connect(self.set_dracula)
        self.dracula.setProperty('class', 'dracula')
        layer_2.addWidget(self.white)
        layer_2.addWidget(self.dracula)
        self.color_cfg.setLayout(layer_2)

        self.save_btn = CommonBtn('保存', self)
        self.save_btn.clicked.connect(self.save)
        layer.addWidget(self.server_cfg)
        layer.addWidget(self.color_cfg)
        layer.addWidget(self.save_btn)
        self.setLayout(layer)
Exemple #2
0
    def __init__(self, parent, top):
        super().__init__(parent)
        self.top = top
        self.setProperty('class', 'user-info')
        layer = CommonHBox()

        self.left_frm = qt.QFrame(self)
        self.left_frm.setProperty('class', 'left')
        left_layer = qt.QVBoxLayout()
        self.avatar = Avatar(self.left_frm, top)
        left_layer.addWidget(self.avatar)
        self.left_frm.setLayout(left_layer)

        self.right_frm = qt.QFrame(self)
        self.right_frm.setProperty('class', 'right')
        right_layer = qt.QVBoxLayout()
        self.nick = SuperInput(self.left_frm, ico=0xe007)
        self.act = SuperInput(self.right_frm, ico=0xe006)
        self.act.input.setEnabled(False)
        self.pwd = SuperInput(self.right_frm, ico=0xe008)
        right_layer.addWidget(self.nick)
        right_layer.addWidget(self.act)
        right_layer.addWidget(self.pwd)
        self.right_frm.setLayout(right_layer)

        layer.addWidget(self.left_frm)
        layer.addWidget(self.right_frm)
        self.setLayout(layer)
Exemple #3
0
    def __init__(self, parent, top, name, svg, sub, id_):
        super().__init__(parent)
        self.setProperty("class", "prop")
        self.top = top
        self.id_ = id_
        self.set_active()

        layout = Qt.QVBoxLayout()

        self.text_label = Qt.QLabel(name, self)
        self.detail_frame = Qt.QFrame(self)
        self.detail_frame.setProperty('class', 'detail')

        detail_layout = Qt.QHBoxLayout()

        self.svg_label = Svg(self.detail_frame, svg)
        self.svg_label.clicked.connect(self.toggle_prop)
        prop_frame = Qt.QFrame(self.detail_frame)
        prop_frame.setProperty('class', 'sub_props')
        prop_layout = Qt.QHBoxLayout()

        for i in sub:
            sub_p = SubProp(prop_frame, self.top, id_, i)
            prop_layout.addWidget(sub_p)

        prop_frame.setLayout(prop_layout)

        detail_layout.addWidget(self.svg_label)
        detail_layout.addWidget(prop_frame)
        self.detail_frame.setLayout(detail_layout)

        layout.addWidget(self.text_label)
        layout.addWidget(self.detail_frame)
        self.setLayout(layout)
Exemple #4
0
    def __init__(self,
                 top,
                 parent,
                 svg,
                 init_value=50,
                 init_info=None,
                 id_='',
                 keys=()):
        super().__init__(parent)
        self.setProperty('class', 'prop')
        self.top = top
        self.width_ = 160
        self.height_ = 24
        self.keys = keys
        self.info_rows = []
        self.id_ = id_
        layout = Qt.QHBoxLayout()

        self.svg = Svg(self, svg)

        self.value_container = Qt.QFrame(self)
        self.value_container.setProperty('class', 'value-container')
        value_layout = Qt.QVBoxLayout()

        self.value_crop = Qt.QLabel(self.value_container)
        self.value_crop.setProperty('class', 'crop')
        self.value_crop.setFixedHeight(self.height_ - 2)

        self.value_content = Qt.QLabel(self.value_crop)
        self.value_content.setProperty('class', 'content')
        self.value_content.move(0, 0)
        self.value_content.setFixedSize(self.width_, self.height_ - 2)

        value_layout.addWidget(self.value_crop)
        value_layout.setContentsMargins(0, 0, 0, 0)
        value_layout.setSpacing(0)
        self.value_container.setLayout(value_layout)
        self.value_container.setFixedSize(self.width_, self.height_)

        self.info_container = Qt.QFrame(self)
        self.info_container.setProperty('class', 'info-container')
        self.info_layout = Qt.QVBoxLayout()
        self.refresh_info()
        self.info_container.setLayout(self.info_layout)

        layout.setAlignment(Qt.Qt.AlignLeft)
        layout.addWidget(self.svg)
        layout.addWidget(self.value_container)
        layout.addWidget(self.info_container)
        self.setLayout(layout)

        self.update_value(init_value)
        self.update_info(init_info or {})
    def __init__(self, parent=None, show=True):
        Qt.QMainWindow.__init__(self, parent)

        # create the frame
        self.frame = Qt.QFrame()
        vlayout = Qt.QVBoxLayout()

        # add the pyvista interactor object
        self.plotter = QtInteractor(self.frame)
        vlayout.addWidget(self.plotter.interactor)

        self.frame.setLayout(vlayout)
        self.setCentralWidget(self.frame)

        # simple menu
        mainMenu = self.menuBar()
        fileMenu = mainMenu.addMenu('File')
        editMenu = mainMenu.addMenu('Edit')

        # opening a mesh file
        self.open_mesh_action = Qt.QAction('Open Mesh...', self)
        self.open_mesh_action.triggered.connect(self.open_mesh)
        fileMenu.addAction(self.open_mesh_action)

        # exit button
        exitButton = Qt.QAction('Exit', self)
        exitButton.setShortcut('Ctrl+Q')
        exitButton.triggered.connect(self.close)
        fileMenu.addAction(exitButton)

        # create cubic skeleton
        self.cubic_skeleton_action = Qt.QAction('Cubic Skeleton', self)
        self.cubic_skeleton_action.triggered.connect(self.cubic_skeleton)
        editMenu.addAction(self.cubic_skeleton_action)

        # Create voxelized model
        self.create_voxelized_model = Qt.QAction('Voxelize Model', self)
        self.create_voxelized_model.triggered.connect(self.voxelize_model)
        editMenu.addAction(self.create_voxelized_model)

        # split mesh based on max cube faces
        # self.max_cube_slice_action = Qt.QAction('Slice27', self)
        # self.cubic_skeleton_action.triggered.connect(self.max_cube_slice)
        # editMenu.addAction(self.max_cube_slice_action)

        if show:
            self.show()

        self.plotter.add_axes(interactive=None,
                              line_width=2,
                              color=None,
                              x_color=None,
                              y_color=None,
                              z_color=None,
                              xlabel='X',
                              ylabel='Y',
                              zlabel='Z',
                              labels_off=False,
                              box=None,
                              box_args=None)
Exemple #6
0
 def setup(self):
     print("setup ui")
     self.ui=registration_dialog.Ui_Dialog()
     self.frame=Qt.QFrame()
     self.viewerMerged = vtkXYZviewer.XYZviewer(self.frame,1)
     self.viewerMerged.setCubeAxesVisibility(False)
     self.viewerCurrent = vtkXYZviewer.XYZviewer(self.frame,1)
     self.viewerCurrent.setCubeAxesVisibility(False)
     self.ui.setupUi(self)
     self.ui.progressBar.hide()
     #call sdk exe and catch window to QT
     self.__addExe()
     self.__addViewer()
     self.__addFileTree()
     self.__addListView()
     #self.ui.addPickedID.setCheckable(True)
     self.ui.addPickedID.clicked.connect(self.__addPickedID)
     self.ui.save.clicked.connect(self.__saveTrans_inits)
     self.ui.load.clicked.connect(self.__loadTrans_inits)
     self.ui.clear.clicked.connect(self.__clearData)
     self.ui.addPickedID_2.clicked.connect(self.__changeRootPath)
     self.ui.btnTestMerged.clicked.connect(self.__mergedByTransInit)
     self.ui.selectPoints.clicked.connect(self.__setViewerSelectionMode)
     self.ui.selectPoints.setChecked(True)
     self.ui.btn_Previous.clicked.connect(self.showPrevious)
     self.ui.btn_Post.clicked.connect(self.showPost)
     #self.ui.load.clicked.connect(self.ui.comboBox.clear)
     self.ui.close.clicked.connect(self.close)
def get_horizontal_line():
    line = Qt.QFrame()
    line.setFrameShape(Qt.QFrame.HLine)
    line.setFrameShadow(Qt.QFrame.Sunken)
    line.setLineWidth(1)

    return line
Exemple #8
0
    def __init__(self, top):
        super().__init__(flags=Qt.Qt.FramelessWindowHint)
        self.top = top
        self.props_obj = {}
        self.setup_ui()
        self.setAttribute(Qt.Qt.WA_TransparentForMouseEvents)
        self.setAttribute(Qt.Qt.WA_TranslucentBackground)
        layout = Qt.QGridLayout()

        self.frame_background = Qt.QFrame(self)
        self.frame_background.setObjectName('bg')

        self.prop_layout = Qt.QVBoxLayout(self)
        self.prop_elements = []
        self.frame_background.setLayout(self.prop_layout)

        layout.addWidget(self.frame_background)
        self.setLayout(layout)

        self.refresh_thread = Refresh(self)
        self.refresh_thread.start()

        show_pos = self.top.config['pos']
        if len(show_pos) == 0:
            self.show_at_center()
        else:
            self.move(*show_pos)
            self.show()
def makeGeomRenderFrame(w):

    tb = w.addToolBar("Geometry Palette")
    curveCreateAction = Qt.QAction("Create Curve", tb)
    tb.addAction(curveCreateAction)

    curveCreateAction.triggered \
        .connect(ParentedCallback(w, makeCreateCurveTools))

    frame = Qt.QFrame()
    vl = Qt.QVBoxLayout()
    vtkWidget = QVTKRenderWindowInteractor(frame)
    vl.addWidget(vtkWidget)

    ren = vtk.vtkRenderer()
    vtkWidget.GetRenderWindow().AddRenderer(ren)

    colors = vtk.vtkNamedColors()

    ren.SetBackground(colors.GetColor3d("White"))

    iren = vtkWidget.GetRenderWindow().GetInteractor()
    iren.SetInteractorStyle(MyInteractor())

    axes = vtk.vtkAxesActor()
    ren.AddActor(axes)
    ren.ResetCamera()

    frame.setLayout(vl)

    iren.Initialize()
    return frame
Exemple #10
0
    def refresh_info(self):
        # 删除旧元素
        while self.info_layout.count():
            obj = self.info_layout.itemAt(0).widget()
            if isinstance(obj, Qt.QFrame):
                obj.setParent(None)
        self.info_rows = []
        for key in self.keys:
            if key in self.top.config['dont_show_sub'].get(self.id_, []):
                continue
            row = Qt.QFrame(self.info_container)
            row.key = key
            row.setProperty('class', 'row')
            row_layout = Qt.QHBoxLayout()

            label_name = Qt.QLabel(self.top.config['prop_chinese'][key], row)
            label_name.setProperty('class', 'name')
            label_name.key = 'name'

            label_value = Qt.QLabel('0', row)
            label_value.setProperty('class', 'value')
            label_value.key = 'value'

            row_layout.setSpacing(0)
            row_layout.setContentsMargins(0, 0, 0, 0)
            row_layout.addWidget(label_name)
            row_layout.addWidget(label_value)
            row.setLayout(row_layout)
            self.info_layout.addWidget(row)
            self.info_rows.append(row)
Exemple #11
0
    def __init__(self, parent=None, show=True):
        Qt.QMainWindow.__init__(self, parent)

        self.frame = Qt.QFrame()
        vlayout = Qt.QVBoxLayout()
        self.vtk_widget = QtInteractor(self.frame)
        vlayout.addWidget(self.vtk_widget)

        self.frame.setLayout(vlayout)
        self.setCentralWidget(self.frame)

        mainMenu = self.menuBar()
        fileMenu = mainMenu.addMenu('File')

        exitButton = Qt.QAction('Exit', self)
        exitButton.setShortcut('Ctrl+Q')
        exitButton.triggered.connect(self.close)

        fileMenu.addAction(exitButton)

        meshMenu = mainMenu.addMenu('Mesh')
        self.add_sphere_action = Qt.QAction('Add Sphere', self)

        self.add_sphere_action.triggered.connect(self.add_sphere)
        meshMenu.addAction(self.add_sphere_action)

        if show:
            self.show()
 def _populate_table(self, elements=[]):
     self.signalMapper2 = QtCore.QSignalMapper(self)
     self.signalMapper2.mapped[Qt.QWidget].connect(self.elementToggler)
     for i in pt_indexes:
         pt_button = HoverableButton(i)
         pt_button.setStyleSheet("""
                                 padding-left: 5px;
                                 padding-right: 3px;
                                 padding-top: 1px;
                                 padding-bottom: 1px;""")
         if i in elements:
             pt_button.setChecked(True)
         self.setCellWidget(pt_indexes[i][0], pt_indexes[i][1], pt_button)
         pt_button.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
         pt_button.toggled.connect(self.signalMapper2.map)
         self.signalMapper2.setMapping(pt_button, pt_button)
     line = Qt.QFrame()
     line.setFrameShape(Qt.QFrame.HLine)
     line.setFrameShadow(Qt.QFrame.Sunken)
     self.setCellWidget(6, 3, line)
     #dissable inert gasses, H and Li:
     for i in ['H', 'He', 'Ne', 'Ar', 'Xe', 'Kr', 'Rn', 'Li']:
         self.cellWidget(pt_indexes[i][0],
                         pt_indexes[i][1]).setEnabled(False)
     lant_text = Qt.QLabel('Lan')
     act_text = Qt.QLabel('Act')
     lant_text.setAlignment(QtCore.Qt.AlignCenter)
     act_text.setAlignment(QtCore.Qt.AlignCenter)
     self.setCellWidget(5, 2, lant_text)
     self.setCellWidget(6, 2, act_text)
     lant_text.setEnabled(False)
     act_text.setEnabled(False)
     self.setMinimumWidth(self.horizontalHeader().length() + 10)
Exemple #13
0
    def __init__(self, parent=None, show=True):
        Qt.QMainWindow.__init__(self, parent)

        # create the frame
        self.frame = Qt.QFrame()
        vlayout = Qt.QVBoxLayout()

        # add the pyvista interactor object
        self.plotter = QtInteractor(self.frame)
        vlayout.addWidget(self.plotter.interactor)

        self.frame.setLayout(vlayout)
        self.setCentralWidget(self.frame)

        # simple menu to demo functions
        mainMenu = self.menuBar()
        fileMenu = mainMenu.addMenu('File')
        exitButton = Qt.QAction('Exit', self)
        exitButton.setShortcut('Ctrl+Q')
        exitButton.triggered.connect(self.close)
        fileMenu.addAction(exitButton)

        # allow adding a sphere
        meshMenu = mainMenu.addMenu('Mesh')
        self.add_sphere_action = Qt.QAction('Add Sphere', self)
        self.add_sphere_action.triggered.connect(self.add_sphere)
        meshMenu.addAction(self.add_sphere_action)

        if show:
            self.show()
Exemple #14
0
    def __init__(self, player, top):
        super().__init__(parent=player)
        self.setProperty("class", "login")
        self.top = top
        self.dialog = None
        self.req_id = 0

        layer = CommonVBox()

        toggle_layer = CommonHBox()
        self.toggle_frm = ToggleLogin(self, top)
        toggle_layer.addWidget(self.toggle_frm)
        layer.addLayout(toggle_layer)

        mid_frame = qt.QFrame(self)
        input_layer = qt.QVBoxLayout()
        self.nick_ipt = SuperInput(self, placeholder="昵称", ico=0xe007)
        self.nick_ipt.hide()
        self.act_ipt = SuperInput(self, placeholder="账号", ico=0xe006)
        self.pwd_ipt = SuperInput(self, placeholder="密码", ico=0xe008)
        input_layer.addWidget(self.nick_ipt)
        input_layer.addWidget(self.act_ipt)
        input_layer.addWidget(self.pwd_ipt)
        mid_frame.setLayout(input_layer)
        layer.addWidget(mid_frame, 1)

        self.submit = IcoButton(self.top, parent=self, text="登录", ico=0xe001)
        self.submit.clicked.connect(self.click_submit)
        layer.addWidget(self.submit, alignment=qt.Qt.AlignHCenter)

        self.setLayout(layer)

        self.submit_signal.connect(self.result)
        self.dialog_click.connect(self.dialog_btn_click)
Exemple #15
0
    def __init__(self, parent=None):

        Qt.QMainWindow.__init__(self, parent)
        self.frame = Qt.QFrame()
        self.layout = Qt.QVBoxLayout()
        self.vtkWidget = QVTKRenderWindowInteractor(self.frame)

        # Create vedo renderer and add objects and callbacks
        self.vp = Plotter(qtWidget=self.vtkWidget)
        self.cbid = self.vp.addCallback("key press", self.onKeypress)
        self.imgActor = Picture(
            "https://icatcare.org/app/uploads/2018/07/Helping-your-new-cat-or-kitten-settle-in-1.png"
        )
        self.text2d = Text2D("Use slider to change contrast")

        self.slider = Qt.QSlider(1)
        self.slider.valueChanged.connect(self.onSlider)
        self.layout.addWidget(self.vtkWidget)
        self.layout.addWidget(self.slider)

        self.frame.setLayout(self.layout)
        self.setCentralWidget(self.frame)
        self.vp.show(self.imgActor, self.text2d,
                     mode='image')  # build the vedo rendering
        self.show()  # show the Qt Window
Exemple #16
0
    def __init__(self, parent, top):
        super().__init__(parent)
        self.top = top
        self.setProperty("class", "act-info")
        layer = qt.QVBoxLayout()

        self.user_info = UserInfo(self, top)
        self.game_num = qt.QLabel(self)
        self.win_num = qt.QLabel(self)
        btn_frm = qt.QFrame(self)
        btn_layer = CommonHBox()
        self.save_btn = IcoButton(self.top, btn_frm, '保存', ico=0xe010)
        self.save_btn.clicked.connect(self.do_save)
        self.exit_btn = IcoButton(self.top, btn_frm, '退出', ico=0xe009)
        self.exit_btn.clicked.connect(self.do_exit)
        btn_layer.addWidget(self.save_btn)
        btn_layer.addWidget(self.exit_btn)
        btn_frm.setLayout(btn_layer)

        layer.addWidget(self.user_info, 3)
        layer.addWidget(self.game_num, 2)
        layer.addWidget(self.win_num, 1)
        layer.addWidget(btn_frm)
        self.setLayout(layer)
        self.save_signal.connect(self.save_result)
    def __init__(self, parent=None):
        Qt.QMainWindow.__init__(self, parent)

        self.frame = Qt.QFrame()

        self.vl = Qt.QVBoxLayout()
        self.vtkWidget = QVTKRenderWindowInteractor(self.frame)
        self.vl.addWidget(self.vtkWidget)

        self.ren = vtk.vtkRenderer()
        self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
        self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()

        # Create source
        source = vtk.vtkSphereSource()
        source.SetCenter(0, 0, 0)
        source.SetRadius(5.0)

        # Create a mapper
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputConnection(source.GetOutputPort())

        # Create an actor
        actor = vtk.vtkActor()
        actor.SetMapper(mapper)

        self.ren.AddActor(actor)

        self.ren.ResetCamera()

        self.frame.setLayout(self.vl)
        self.setCentralWidget(self.frame)

        self.show()
        self.iren.Initialize()
Exemple #18
0
    def __init__(self, parent=None, show=True):
        Qt.QMainWindow.__init__(self, parent)
        with open('config.json') as f:
            self.config_data = json.load(f)
        self.query_matcher = QueryMatcher(self.config_data["FEATURE_DATA_FILE"])
        self.supported_file_types = [".ply", ".off"]
        self.buttons = {}
        self.ds = reader.DataSet("")
        self.meshes = []
        self.normalizer = Normalizer()
        self.smlw = None
        self.setWindowTitle('Source Mesh Window')
        self.frame = Qt.QFrame()
        self.QTIplotter = None
        self.vlayout = Qt.QVBoxLayout()
        self.frame.setLayout(self.vlayout)
        self.setCentralWidget(self.frame)
        self.hist_dict = {}
        self.setAcceptDrops(True)
        # Create main menu
        mainMenu = self.menuBar()
        fileMenu = mainMenu.addMenu('File')
        exitButton = Qt.QAction('Exit', self)
        exitButton.setShortcut('Ctrl+Q')
        exitButton.triggered.connect(self.close)
        fileMenu.addAction(exitButton)

        viewMenu = mainMenu.addMenu('View')
        exitButton = Qt.QAction('Plot tSNE', self)
        exitButton.triggered.connect(self.plot_tsne)
        viewMenu.addAction(exitButton)

        # Create load button and init action
        self.load_button = QPushButton("Load or drop mesh to query")
        self.load_button.clicked.connect(lambda: self.load_and_prep_query_mesh(self.open_file_name_dialog()))
        self.load_button.setFont(QtGui.QFont("arial", 30))
        # Create Plots widget
        self.graphWidget = pg.PlotWidget()
        self.graphWidget.setBackground('w')

        # Create and add widgets to layout

        n_sing, n_hist, mapping_of_labels = get_sizes_features(features_file=self.config_data["FEATURE_DATA_FILE"],with_labels=True)

        # self.hist_labels = list({**FeatureExtractor.get_pipeline_functions()[1]}.values())
        self.hist_labels = [val for key, val in mapping_of_labels.items() if "hist_" in key]
        self.tableWidget = TableWidget({}, self, {})
        self.tableWidget.hide()
        self.vlayout.addWidget(self.load_button)

        # Position MainWindow
        screen_topleft = QDesktopWidget().availableGeometry().topLeft()
        screen_height = QDesktopWidget().availableGeometry().height()
        width = (QDesktopWidget().availableGeometry().width() * 0.4)
        self.move(screen_topleft)
        self.resize(width, screen_height - 50)

        if show:
            self.show()
 def __init__(self, viewWin, st, slider, timeLabel, parent=None):
     # Qt.QVBoxLayout.__init__(self, parent)
     self.win = viewWin
     self.frame = Qt.QFrame()
     # get the RenderWindowInteractor from vtk window
     self.vtkWidget = QVTKRenderWindowInteractor(self.frame)
     # add the RenderWindowInteractor to the PyQt5 GUI
     self.win.addWidget(self.vtkWidget)
     self.vtkRen = vtkWin(self.vtkWidget, slider, timeLabel)
Exemple #20
0
    def __init__(self,
                 plots=None,
                 las_header=None,
                 axes_on=False,
                 app=None,
                 background=(.2, .3, .4)):
        """
        :param plots: list of VTKPointClouds to plot
        :param las_header: a las_header that is optionally supplied if reading from a las file, helpful for saving
        :param axes_on: flag for turning axes on/off
        :param app: the main QApplication driving the GUI
        :param background: tuple of 0-1's for background color
        """
        super().__init__()
        self.plots = plots
        self.las_header = las_header
        self.background = background
        self.default_viewup = (0.0, 1.0, 0.0)
        self.axes_on = axes_on
        # self.app = Qt.QApplication(sys.argv)
        self.app = app
        self.main = Qt.QMainWindow()
        self.main.__init__()
        self.frame = Qt.QFrame()
        self.hl = Qt.QHBoxLayout()
        self.bl = Qt.QVBoxLayout()

        self.widgets = []
        self.widget_defaults = []
        self.widget_point_actors = []
        self.axes_actors = []
        if self.plots is not None:
            for i in range(len(plots)):
                vtk_widget = QVTKRenderWindowInteractor(self.frame)
                self.widgets.append(vtk_widget)
                self.hl.addWidget(vtk_widget)
                self.axes_actors.append(vtk.vtkCubeAxesActor2D())
                self.plot_point_cloud_qt(plots[i], vtk_widget)

            for w in self.widgets:
                position = w.GetRenderWindow().GetInteractor(
                ).GetInteractorStyle().camera.GetPosition()
                focus = w.GetRenderWindow().GetInteractor().GetInteractorStyle(
                ).camera.GetFocalPoint()
                viewup = w.GetRenderWindow().GetInteractor(
                ).GetInteractorStyle().camera.GetViewUp()
                self.widget_defaults.append((position, focus, viewup))

        self.hl.addLayout(self.bl)
        self.add_buttons()
        self.frame.setLayout(self.hl)
        self.main.setCentralWidget(self.frame)
        self.main.show()
        for w in self.widgets:
            w.GetRenderWindow().GetInteractor().Initialize()
            w.GetRenderWindow().GetInteractor().Start()
Exemple #21
0
    def __init__(self, parent=None, show=True):
        Qt.QMainWindow.__init__(self, parent)

        # create the frame
        self.frame = Qt.QFrame()
        vlayout = Qt.QVBoxLayout()

        # add the pyvista interactor object
        self.plotter = QtInteractor(self.frame)

        vlayout.addWidget(self.plotter.interactor)

        self.frame.setLayout(vlayout)
        self.setCentralWidget(self.frame)

        # simple menu
        mainMenu = self.menuBar()
        fileMenu = mainMenu.addMenu('File')
        editMenu = mainMenu.addMenu('Edit')
        
        # opening a mesh file
        self.open_mesh_action = Qt.QAction('Open Mesh...', self)
        self.open_mesh_action.triggered.connect(self.open_mesh)
        fileMenu.addAction(self.open_mesh_action)

        # set centroid
        self.skewed_centroid_action = Qt.QAction('Skewed Centroid', self)
        self.skewed_centroid_action.triggered.connect(self.skewed_centroid_check)
        fileMenu.addAction(self.skewed_centroid_action)
        
        # save screenshot
        self.save_screenshot_action = Qt.QAction('Save Screenshot', self)
        self.save_screenshot_action.triggered.connect(self.save_screenshot)
        fileMenu.addAction(self.save_screenshot_action)

        # exit button
        exitButton = Qt.QAction('Exit', self)
        exitButton.setShortcut('Ctrl+Q')
        exitButton.triggered.connect(self.close)
        fileMenu.addAction(exitButton)
        
        # Show max cube & raytracing process
        self.max_cube_action = Qt.QAction('Max Cube', self)
        self.max_cube_action.triggered.connect(self.show_max_cube)
        editMenu.addAction(self.max_cube_action)

        # Show max cube & raytracing process
        self.max_cuboid_action = Qt.QAction('Max Cuboid', self)
        self.max_cuboid_action.triggered.connect(self.max_cuboid)
        editMenu.addAction(self.max_cuboid_action)
        
        if show:
            self.show()
        
        self.plotter.add_axes(interactive=None, line_width=2, x_color=None, y_color=None, z_color=None, xlabel='X', ylabel='Y', zlabel='Z', labels_off=False, box= None, box_args=None)
Exemple #22
0
    def __init__(self, parent=None):

        self.curId = 0000000
        self.curKeyValue = ''
        self.curIndex = 0
        self.hotkeys = []
        self.keylabels = []
        self.curActor1 = None
        self.curActor2 = None
        self.meshopacity = 0.5

        #self.LABELS = [[],[]]
        self.LABELS = {}
        #inits
        Qt.QMainWindow.__init__(self, parent)
        self.setWindowTitle('Mesh Labeller')
        self.frame = Qt.QFrame()

        #define layout`
        self.vl = Qt.QGridLayout()
        self.vl.setSpacing(10)

        self.add_title_left('Mesh File Directory:', 1, 0)
        self.add_title_left('CSV for ids:', 2, 0)
        self.add_title_left('Output File:', 3, 0)
        self.add_title_left('Hot Key File (CSV):', 4, 0)
        self.add_title_left('Mesh Opacity', 5, 0)
        self.meshdirectoryline = self.add_editor("data/meshes/EXPT1", 1, 1, 1,
                                                 1)
        self.dataframe_filename = self.add_editor(r"V3_labeled.pkl", 2, 1, 1,
                                                  1)
        self.outputline = self.add_editor("output.json", 3, 1, 1, 1)
        self.hotkeyline = self.add_editor("data/hotkeys.csv", 4, 1, 1, 1)
        self.opacityline = self.add_editor("0.5", 5, 1, 1, 1)
        #self.opacityline.returnPressed.connect(self.testing123())

        self.add_load_button('LOAD', 6, 1)
        self.add_title('Current Hot Keys:', 7, 1)
        self.hotkeyvalueline = self.add_title('', 8, 1)

        self.add_backward_button('<<', 9, 0)
        self.add_vtk_window(9, 1)
        self.add_forward_button('>>', 9, 2)

        #self.filenameline = self.add_title('DEFAULT',10,1)
        self.filenameline = self.add_editor_center("DEFAULT", 10, 1)
        self.add_button('Continue Labelling', 11, 1)
        self.add_save_button('SAVE!', 12, 1)
        self.add_help_button('HELP', 13, 2)

        #set layout for frame
        self.frame.setLayout(self.vl)
        self.setCentralWidget(self.frame)
        self.show()
Exemple #23
0
 def make_histogram_view_and_frame(cls, base_scene, parent=None):
     histogram_frame = Qt.QFrame(parent)
     histogram_frame.setMinimumSize(Qt.QSize(120, 60))
     histogram_frame.setFrameShape(Qt.QFrame.StyledPanel)
     histogram_frame.setFrameShadow(Qt.QFrame.Sunken)
     histogram_frame.setLayout(Qt.QHBoxLayout())
     histogram_frame.layout().setSpacing(0)
     histogram_frame.layout().setContentsMargins(Qt.QMargins(0, 0, 0, 0))
     histogram_view = cls(base_scene, histogram_frame)
     histogram_frame.layout().addWidget(histogram_view)
     return histogram_view, histogram_frame
Exemple #24
0
    def __init__(self, parent=None):
        Qt.QMainWindow.__init__(self, parent)

        self.frame = Qt.QFrame()
        self.vl = Qt.QVBoxLayout()
        self.vtkWidget = QVTKRenderWindowInteractor(self.frame)
        self.vl.addWidget(self.vtkWidget)

        self.ren = vtk.vtkRenderer()
        self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
        self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()

        # Create source
        sphere = vtk.vtkSphereSource()
        sphere.SetCenter(0, 0, 0)
        sphere.SetRadius(1.0)
        sphere.SetPhiResolution(10)

        # Create a mapper
        sphere_mapper = vtk.vtkPolyDataMapper()
        sphere_mapper.SetInputConnection(sphere.GetOutputPort())

        # Create an actor
        sphere_actor = vtk.vtkActor()
        sphere_actor.SetMapper(sphere_mapper)

        cube = vtk.vtkCubeSource()
        cube.SetCenter(0, 0, 0)
        cube.SetXLength(1)
        cube.SetYLength(1)
        cube.SetZLength(5)

        cube_mapper = vtk.vtkPolyDataMapper()
        cube_mapper.SetInputConnection(cube.GetOutputPort())

        cube_actor = vtk.vtkActor()
        cube_actor.SetMapper(cube_mapper)

        self.vtkWidget.SetInteractorStyle(MouseInteractorStyle())

        self.ren.AddActor(sphere_actor)
        self.ren.AddActor(cube_actor)
        self.ren.SetBackground(0.1, 0.1, 0.1)
        self.ren.ResetCamera()
        self.frame.setLayout(self.vl)
        self.setCentralWidget(self.frame)

        self.show()
        self.iren.Initialize()
        self.iren.Start()
Exemple #25
0
    def __init__(self):
        super().__init__()

        self.setWindowTitle('Widget-Info: exchange rate and weather')

        self.exchange_rate_USD = Qt.QLabel()
        self.exchange_rate_EUR = Qt.QLabel()

        self.weather_1 = Qt.QLabel()
        self.weather_2 = Qt.QLabel()
        self.weather_3 = Qt.QLabel()

        layout = Qt.QFormLayout()
        layout.addRow('USD:', self.exchange_rate_USD)
        layout.addRow('EUR:', self.exchange_rate_EUR)

        line = Qt.QFrame()
        line.setFrameShape(Qt.QFrame.HLine)
        line.setFrameShadow(Qt.QFrame.Sunken)
        line.setLineWidth(1)

        layout.addRow(line)

        layout.addRow('Магнитогорск:', self.weather_1)
        layout.addRow('Челябинск:', self.weather_2)
        layout.addRow('Екатеринбург:', self.weather_3)

        self.setLayout(layout)

        self.thread_exchange_rate_USD = ThreadExchangeRate(self, 'USD')
        self.thread_exchange_rate_USD.about_exchange_rate.connect(
            self.exchange_rate_USD.setText)
        self.thread_exchange_rate_USD.start()

        self.thread_exchange_rate_EUR = ThreadExchangeRate(self, 'EUR')
        self.thread_exchange_rate_EUR.about_exchange_rate.connect(
            self.exchange_rate_EUR.setText)
        self.thread_exchange_rate_EUR.start()

        self.thread_weather_1 = ThreadGetWeather(self, 'Магнитогорск')
        self.thread_weather_1.about_weather.connect(self.weather_1.setText)
        self.thread_weather_1.start()

        self.thread_weather_2 = ThreadGetWeather(self, 'Челябинск')
        self.thread_weather_2.about_weather.connect(self.weather_2.setText)
        self.thread_weather_2.start()

        self.thread_weather_3 = ThreadGetWeather(self, 'Екатеринбург')
        self.thread_weather_3.about_weather.connect(self.weather_3.setText)
        self.thread_weather_3.start()
Exemple #26
0
    def __init__(self, head, top):
        super().__init__(top)
        self.head = head
        self.top = top
        self.setProperty('class', 'game-head-dialog')
        self.at = 'c'
        # 等待创建,为取消做标志物
        self.creating = False
        self.join_id = None

        layer = CommonVBox()

        self.create_frm = qt.QFrame(self)
        create_layer = CommonVBox()
        self.create_state = qt.QLabel('创建中...', self.create_frm)
        self.cancel_create = CommonBtn('取消', self.create_frm)
        self.cancel_create.clicked.connect(self.close)
        create_layer.addWidget(self.create_state)
        create_layer.addWidget(self.cancel_create)
        self.create_frm.setLayout(create_layer)

        self.join_frm = qt.QFrame(self)
        join_layer = CommonVBox()
        self.join_state = qt.QLabel('输入房间号(数字)', self.join_frm)
        self.join_input = qt.QLineEdit(self.join_frm)
        self.join_btn = CommonBtn('查询', self.join_frm)
        self.join_btn.clicked.connect(self.do_join)
        join_layer.addWidget(self.join_state)
        join_layer.addWidget(self.join_input)
        join_layer.addWidget(self.join_btn)
        self.join_frm.setLayout(join_layer)

        layer.addWidget(self.create_frm)
        layer.addWidget(self.join_frm)
        self.setLayout(layer)

        self.search_signal.connect(self.search_result)
Exemple #27
0
    def __init__(self, parent, top):
        super().__init__(parent)
        self.top = top
        self.preserve = {}
        self.setProperty('class', 'player')
        self.setFixedWidth(240)
        layer = CommonHBox()

        self.base_info = qt.QFrame(self)
        self.base_info.setProperty('class', 'base')
        base_info_layer = CommonVBox()
        self.avatar = AvatarLabel(self.base_info, (66, 66), 8)
        self.avatar.setProperty('class', 'avatar')
        base_info_layer.addWidget(self.avatar)
        self.base_info.setLayout(base_info_layer)

        self.game_info = qt.QFrame(self)
        self.game_info.setProperty('class', 'game')
        game_info_layer = CommonVBox()
        self.nick = qt.QLabel(self.base_info)
        self.nick.setProperty('class', 'nick')
        self.nick.setWordWrap(True)
        self.game_num = qt.QLabel(self.game_info)
        self.game_num.setProperty('class', 'game_num')
        self.win_num = qt.QLabel(self.game_info)
        self.win_num.setProperty('class', 'win_num')
        game_info_layer.addWidget(self.nick)
        game_info_layer.addWidget(self.game_num)
        game_info_layer.addWidget(self.win_num)
        self.game_info.setLayout(game_info_layer)

        layer.addWidget(self.base_info)
        layer.addWidget(self.game_info)
        self.setLayout(layer)

        self.update_info(False)
Exemple #28
0
    def __init__(self, parent = None):
        Qt.QMainWindow.__init__(self, parent)
        
        #--Window and Renderer Setting
        
        #Main Window Initialization
        self.frame = Qt.QFrame()
        self.vl = Qt.QVBoxLayout()
        self.vtkWidget = QVTKRenderWindowInteractor(self.frame)
        self.vl.addWidget(self.vtkWidget)

        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(255, 255, 255)
        self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
        self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()
        
        #Renderer Setting
        self.ren.ResetCamera()
        self.frame.setLayout(self.vl)
        self.setCentralWidget(self.frame)
        
        #Start Renderer
        self.iren.Initialize()
        self.show()      
        #----------------------------------
        
        #--Menu & Functions 
        
        #Menu Bar to Wrap All Menu
        mainMenu = self.menuBar()
        
        #Menu on Menu Bar
        fileMenu = mainMenu.addMenu('Meshgrid')
        
        #Submenu Show Meshgrid
        addmeshgrid = Qt.QAction('Add Meshgrid', self)
        addmeshgrid.setShortcut('Ctrl+M')
        addmeshgrid.triggered.connect(self.add_mesh)
        fileMenu.addAction(addmeshgrid)
        
        #Submenu Add Section
        add_section = Qt.QAction("Add Section", self)
        add_section.triggered.connect(self.add_section)
        fileMenu.addAction(add_section)           
        #-----------------------------------
        
        #--Data        
        self.meshgrid = np.loadtxt("meshgrid.txt")
Exemple #29
0
    def __init__(self, parent, mode):
        super(InputColorRGB, self).__init__(parent)
        self.currentData = mode

        self.lineedit_RGB = Qt.QLineEdit(self)
        self.lineedit_RGB.setPlaceholderText('R, G, B (Value range: 0 .. 1)')

        self.button_update_rgb_color = Qt.QPushButton('Update')
        self.button_update_rgb_color.clicked.connect(self.adaptRGBColor)

        self.frame = Qt.QFrame()
        self.vl = Qt.QVBoxLayout()
        self.frame.setLayout(self.vl)
        self.setCentralWidget(self.frame)
        self.vl.addWidget(self.lineedit_RGB)
        self.vl.addWidget(self.button_update_rgb_color)
Exemple #30
0
    def __init__(self, parent = None):
        # Qt.QMainWindow.__init__(self, parent)

        self.frame = Qt.QFrame()
        self.vl = Qt.QVBoxLayout()
        self.vtkWidget = QVTKRenderWindowInteractor(self.frame)
        self.vl.addWidget(self.vtkWidget)

        Label = QLabel("Test Label")
        self.vl.addWidget(Label)

        self.btn = QPushButton("Click mig")
        self.vl.addWidget(self.btn)
        self.btn.clicked.connect(self.resetView)

        self.ren = vtk.vtkRenderer()
        self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)

        self.vtkWidget.SetInteractorStyle(MouseInteractorStyle())

        self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()

        # Create source
        sphere = vtk.vtkCubeSource()
        sphere.SetCenter(0, 0, 0)
        sphere.SetXLength(5.0)
        sphere.SetYLength(15.0)
        sphere.SetZLength(5.0)

        # Create a mapper
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputConnection(sphere.GetOutputPort())

        # Create an actor
        actor = vtk.vtkActor()
        actor.SetMapper(mapper)

        self.ren.AddActor(actor)
        self.ren.GradientBackgroundOn()
        self.ren.SetBackground2(0.2, 0.4, 0.6)
        self.ren.SetBackground(1, 1, 1)

        self.frame.setLayout(self.vl)
        self.iren.Initialize()
        self.iren.Start()
        self.frame.show()