예제 #1
0
def tryout_with_qt():
    import sys
    from PyQt4 import QtCore, QtWebKit, QtWidgets
    from os.path import join, dirname
    import ibeis.viz

    class Browser(QtWebKit.QWebView):
        def __init__(self):
            super(Browser, self).__init__()
            self.loadFinished.connect(self._result_available)

        def _result_available(self, ok):
            pass
            #frame = self.page().mainFrame()
            #print(unicode(frame.toHtml()).encode('utf-8'))

    app = QtWidgets.QApplication(sys.argv)

    view = Browser()
    view.show()
    path = join(dirname(ibeis.viz.__file__), 'd3_example.html')
    view.load(QtCore.QUrl(path))
    view.page().settings().setAttribute(
        QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)

    insp = QtWebKit.QWebInspector()
    insp.setPage(view.page())
    insp.show()

    app.exec_()
예제 #2
0
def get_app_qt4(*args, **kwargs):
    """Create a new qt4 app or return an existing one."""
    from PyQt4 import QtGui, QtWidgets
    app = QtWidgets.QApplication.instance()
    if app is None:
        if not args:
            args = ([''],)
        app = QtWidgets.QApplication(*args, **kwargs)
    return app
    def insert_column_in_summary_table(self, roi_index=-1):
        col_offset = 3
        if roi_index == -1:
            roi_index = 0

        roi_index += col_offset
        self.ui.summary_table.insertColumn(roi_index)
        item = QtWidgets.QTableWidgetItem()
        self.ui.summary_table.setHorizontalHeaderItem(roi_index, item)
        self.renamed_summary_table_region_header()
    def __init_ui__(self):
        # Define some stuff for the window
        self.setWindowTitle("Material Generator")
        self.setMinimumWidth(250)
        self.setMinimumHeight(50)
        self.setMaximumWidth(500)
        self.setMaximumHeight(600)

        # Define some layouts
        self.main_layout = QtWidgets.QVBoxLayout()
        self.btn_layout = QtWidgets.QVBoxLayout()
        self.check_box_layout = QtWidgets.QHBoxLayout()

        # Define some check boxes for lambert or blinn shaders
        self.blinnChxBox = QtWidgets.QCheckBox("Blinn")
        self.lambertChkBox = QtWidgets.QCheckBox("Lambert", checked = True)

        #Define a sort of horizontal spacer
        self.spacerFrame = QtWidgets.QFrame()

        # Define some buttons
        self.reRollBtn = QtWidgets.QPushButton("Re-roll Material Color")
        self.genShadersBtn = QtWidgets.QPushButton("Apply Random Shader")
        self.defLambertBtn = QtWidgets.QPushButton("Apply Default lambert1 Shader")
        self.reRollOverrideBtn = QtWidgets.QPushButton("Re-roll Wireframe Color")
        self.toggleWireFrameOnShadedBtn = QtWidgets.QPushButton("Toggle Wireframe on Shaded")
        self.toggleSelectionHighlightingBtn = QtWidgets.QPushButton("Toggle Selection Highlighting")

        # Add elements to window
        self.main_layout.addLayout(self.check_box_layout)
        self.check_box_layout.addWidget(self.lambertChkBox)
        self.check_box_layout.addWidget(self.blinnChkBox)
        self.main_layout.addLayout(self.btn_layout)
        self.main_layout.addWidget(self.genShadersBtn)
        self.main_layout.addWidget(self.reRollBtn)
        self.main_layout.addWidget(self.spacerFrame)
        self.main_layout.addWidget(self.defLambertBtn)
        self.main_layout.addWidget(self.spacerFrame)
        self.main_layout.addWidget(self.toggleWireframeOnShadedBtn)
        self.main_layout.addWidget(self.reRollOverrideBtn)
        self.main_layout.addWidget(self.spacerFrame)
        self.main_layout.addWidget(self.toggleSelectionHighlightingBtn)
        self.setLayout(self.main_layout)

        #Show UI
        name = 'matGenWin'
        self.deleteUI(name)
        self.setObjectName(name)
        self.show()
예제 #5
0
 def setupUi(self, MainWindow):
     MainWindow.resize(500, 500)
     self.centralwidget = QtWidgets.QWidget(MainWindow)
     self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
     MainWindow.setCentralWidget(self.centralwidget)
     QtCore.QMetaObject.connectSlotsByName(MainWindow)
예제 #6
0
import numpy

import matplotlib.pyplot as plot       



class MyWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super(MyWindow, self).__init__()
        ui = Ui_MainWindow()
        ui.setupUi(self)
        self.show()
        
# main function, that starts the application

if __name__ == "__main__":
    
    app = QtWidgets.QApplication(sys.argv)
    
#    MainWindow = QtWidgets.QMainWindow()
#    ui = Ui_MainWindow()
#    ui.setupUi(MainWindow)
#    MainWindow.show()
    
    window = MyWindow()        
    
    sys.exit(app.exec_())
    
        
        
예제 #7
0
    def __init__(self, viewer, snippets=None):

        self.model = None
        self.viewer = viewer
        QtGui.QWidget.__init__(self)
        self.layout = QtGui.QVBoxLayout(self)
        self.setLayout(self.layout)
        self.c = None

        self.tools = QtGui.QHBoxLayout(self)
        self.layout.addLayout(self.tools)

        self.runbutton = QtGui.QPushButton("Run")
        width = self.runbutton.fontMetrics().boundingRect("Run").width() + 20
        self.runbutton.setMaximumWidth(width)
        self.tools.addWidget(self.runbutton)
        self.runbutton.clicked.connect(self.runCode)

        editor = CodeEdit()
        if has_pyqode:
            editor.backend.start(server.__file__)
            editor.panels.append(panels.FoldingPanel())
            editor.panels.append(panels.LineNumberPanel())
            editor.panels.append(panels.SearchAndReplacePanel(),
                                 panels.SearchAndReplacePanel.Position.BOTTOM)
            editor.panels.append(panels.EncodingPanel(),
                                 api.Panel.Position.TOP)
            editor.add_separator()
            editor.panels.append(pypanels.QuickDocPanel(),
                                 api.Panel.Position.BOTTOM)
            sh = editor.modes.append(PythonSH(editor.document()))
            editor.modes.append(modes.CaretLineHighlighterMode())
            editor.modes.append(modes.CodeCompletionMode())
            editor.modes.append(modes.ExtendedSelectionMode())
            editor.modes.append(modes.FileWatcherMode())
            editor.modes.append(modes.OccurrencesHighlighterMode())
            editor.modes.append(modes.RightMarginMode())
            editor.modes.append(modes.SmartBackSpaceMode())
            editor.modes.append(modes.SymbolMatcherMode())
            editor.modes.append(modes.ZoomMode())
            editor.modes.append(pymodes.CommentsMode())
            editor.modes.append(pymodes.CalltipsMode())
            auto = pymodes.PyAutoCompleteMode()
            auto.logger.setLevel(logging.CRITICAL)
            editor.modes.append(auto)
            editor.modes.append(pymodes.PyAutoIndentMode())
            editor.modes.append(pymodes.PyIndenterMode())
            editor.show()
        else:
            editor.setStyleSheet(
                'font-size: 10pt; font-family: Consolas, Courier;')

        self.editor = editor
        self.snippets = snippets
        if self.snippets:
            self.list = QtWidgets.QComboBox(self)
            self.replace_snippet(0)
            for snip_name in self.snippets.keys():
                self.list.addItem(snip_name)
            self.tools.addWidget(self.list)
            QtCore.QObject.connect(self.list,
                                   QtCore.SIGNAL("currentIndexChanged(int)"),
                                   self.replace_snippet)

        self.layout.addWidget(self.editor)

        self.output = QtGui.QTextEdit()
        self.output.setReadOnly(True)
        self.output.setStyleSheet(
            'font-size: 10pt; font-family: Consolas, Courier; background-color: #444;'
        )
        self.layout.addWidget(self.output)