예제 #1
0
def test():
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    from SMlib.widgets.externalshell.pythonshell import ExternalPythonShell
    from SMlib.widgets.externalshell.systemshell import ExternalSystemShell
    import SMlib
    from SMlib.plugins.variableexplorer import VariableExplorer
    settings = VariableExplorer.get_settings()
    shell = ExternalPythonShell(wdir=osp.dirname(SMlib.__file__),
                                ipykernel=True,
                                stand_alone=settings,
                                arguments="-q4thread -pylab -colors LightBG",
                                mpl_patch_enabled=True,
                                light_background=False)
    #    shell = ExternalPythonShell(wdir=osp.dirname(SMlib.__file__),
    #                                interact=True, umd_enabled=True,
    #                                stand_alone=settings,
    #                                umd_namelist=['guidata', 'guiqwt'],
    #                                umd_verbose=True, mpl_patch_enabled=False,
    #                                light_background=False)
    #    shell = ExternalSystemShell(wdir=osp.dirname(SMlib.__file__),
    #                                light_background=False)
    shell.shell.toggle_wrap_mode(True)
    shell.start_shell(False)
    from PyQt4.QtGui import QFont
    font = QFont("Lucida console")
    font.setPointSize(10)
    shell.shell.set_font(font)
    shell.show()
    sys.exit(app.exec_())
예제 #2
0
파일: shortcuts.py 프로젝트: koll00/Gui_SM
def test():
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    table = ShortcutsTable()
    table.show()
    app.exec_()
    print [str(s) for s in table.model.shortcuts]
예제 #3
0
def test():
    """Run Find in Files widget test"""
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    widget = FindInFilesWidget(None)
    widget.show()
    sys.exit(app.exec_())
예제 #4
0
def test():
    """Run path manager test"""
    from SMlib.utils.qthelpers import qapplication
    _app = qapplication()  # analysis:ignore
    test = PathManager(None, sys.path[:-10], sys.path[-10:])
    test.exec_()
    print test.get_path_list()
예제 #5
0
def test(text):
    """Test"""
    from SMlib.utils.qthelpers import qapplication
    _app = qapplication()  # analysis:ignore
    dialog = ImportWizard(None, text)
    if dialog.exec_():
        print dialog.get_data()
예제 #6
0
def test():
    """Array editor test"""
    _app = qapplication()

    arr = np.array(["kjrekrjkejr"])
    print "out:", test_edit(arr, "string array")
    arr = np.array([u"kjrekrjkejr"])
    print "out:", test_edit(arr, "unicode array")
    arr = np.ma.array([[1, 0], [1, 0]], mask=[[True, False], [False, False]])
    print "out:", test_edit(arr, "masked array")
    arr = np.zeros((2, 2), {"names": ("red", "green", "blue"), "formats": (np.float32, np.float32, np.float32)})
    print "out:", test_edit(arr, "record array")
    arr = np.array([(0, 0.0), (0, 0.0), (0, 0.0)], dtype=[(("title 1", "x"), "|i1"), (("title 2", "y"), ">f4")])
    print "out:", test_edit(arr, "record array with titles")
    arr = np.random.rand(5, 5)
    print "out:", test_edit(arr, "float array", xlabels=["a", "b", "c", "d", "e"])
    arr = np.round(np.random.rand(5, 5) * 10) + np.round(np.random.rand(5, 5) * 10) * 1j
    print "out:", test_edit(arr, "complex array", xlabels=np.linspace(-12, 12, 5), ylabels=np.linspace(-12, 12, 5))
    arr_in = np.array([True, False, True])
    print "in:", arr_in
    arr_out = test_edit(arr_in, "bool array")
    print "out:", arr_out
    print arr_in is arr_out
    arr = np.array([1, 2, 3], dtype="int8")
    print "out:", test_edit(arr, "int array")
예제 #7
0
파일: environ.py 프로젝트: koll00/Gui_SM
def main():
    """Run Windows environment variable editor"""
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    dialog = WinUserEnvDialog()
    dialog.show()
    app.exec_()
예제 #8
0
def test():
    """Run path manager test"""
    from SMlib.utils.qthelpers import qapplication
    _app = qapplication()  # analysis:ignore
    test = PathManager(None, sys.path[:-10], sys.path[-10:])
    test.exec_()
    print test.get_path_list()
예제 #9
0
def test(text):
    """Test"""
    from SMlib.utils.qthelpers import qapplication
    _app = qapplication()  # analysis:ignore
    dialog = ImportWizard(None, text)
    if dialog.exec_():
        print dialog.get_data()
예제 #10
0
파일: baseshell.py 프로젝트: koll00/Gui_SM
def test():
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    from SMlib.widgets.externalshell.pythonshell import ExternalPythonShell
    from SMlib.widgets.externalshell.systemshell import ExternalSystemShell
    import SMlib
    from SMlib.plugins.variableexplorer import VariableExplorer
    settings = VariableExplorer.get_settings()
    shell = ExternalPythonShell(wdir=osp.dirname(SMlib.__file__),
                                ipykernel=True, stand_alone=settings,
                                arguments="-q4thread -pylab -colors LightBG",
                                mpl_patch_enabled=True, light_background=False)
#    shell = ExternalPythonShell(wdir=osp.dirname(SMlib.__file__),
#                                interact=True, umd_enabled=True,
#                                stand_alone=settings,
#                                umd_namelist=['guidata', 'guiqwt'],
#                                umd_verbose=True, mpl_patch_enabled=False,
#                                light_background=False)
#    shell = ExternalSystemShell(wdir=osp.dirname(SMlib.__file__),
#                                light_background=False)
    shell.shell.toggle_wrap_mode(True)
    shell.start_shell(False)
    from PyQt4.QtGui import QFont
    font = QFont("Lucida console")
    font.setPointSize(10)
    shell.shell.set_font(font)
    shell.show()
    sys.exit(app.exec_())
예제 #11
0
def test():
    """Array editor test"""
    _app = qapplication()
    
    arr = np.array(["kjrekrjkejr"])
    print "out:", test_edit(arr, "string array")
    arr = np.array([u"kjrekrjkejr"])
    print "out:", test_edit(arr, "unicode array")
    arr = np.ma.array([[1, 0], [1, 0]], mask=[[True, False], [False, False]])
    print "out:", test_edit(arr, "masked array")
    arr = np.zeros((2,2), {'names': ('red', 'green', 'blue'),
                           'formats': (np.float32, np.float32, np.float32)})
    print "out:", test_edit(arr, "record array")
    arr = np.array([(0, 0.0), (0, 0.0), (0, 0.0)],
                   dtype=[(('title 1', 'x'), '|i1'),
                          (('title 2', 'y'), '>f4')])
    print "out:", test_edit(arr, "record array with titles")
    arr = np.random.rand(5, 5)
    print "out:", test_edit(arr, "float array",
                            xlabels=['a', 'b', 'c', 'd', 'e'])
    arr = np.round(np.random.rand(5, 5)*10)+\
                   np.round(np.random.rand(5, 5)*10)*1j
    print "out:", test_edit(arr, "complex array",
                            xlabels=np.linspace(-12, 12, 5),
                            ylabels=np.linspace(-12, 12, 5))
    arr_in = np.array([True, False, True])
    print "in:", arr_in
    arr_out = test_edit(arr_in, "bool array")
    print "out:", arr_out
    print arr_in is arr_out
    arr = np.array([1, 2, 3], dtype="int8")
    print "out:", test_edit(arr, "int array")
예제 #12
0
def test():
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    table = ShortcutsTable()
    table.show()
    app.exec_()
    print [str(s) for s in table.model.shortcuts]
    table.check_shortcuts()
예제 #13
0
파일: browser.py 프로젝트: koll00/Gui_SM
def main():
    """Run web browser"""
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    widget = WebBrowser()
    widget.show()
    widget.set_home_url('http://localhost:7464/')
    widget.go_home()
    sys.exit(app.exec_())
예제 #14
0
파일: browser.py 프로젝트: koll00/Gui_SM
def main():
    """Run web browser"""
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    widget = WebBrowser()
    widget.show()
    widget.set_home_url('http://localhost:7464/')
    widget.go_home()
    sys.exit(app.exec_())
예제 #15
0
파일: status.py 프로젝트: koll00/Gui_SM
def test():
    from PyQt4.QtGui import QMainWindow
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    win = QMainWindow()
    win.setWindowTitle("Status widgets test")
    win.resize(900, 300)
    statusbar = win.statusBar()
    swidgets = []
    for klass in (ReadWriteStatus, EOLStatus, EncodingStatus,
                  CursorPositionStatus, MemoryStatus, CPUStatus):
        swidget = klass(win, statusbar)
        swidgets.append(swidget)
    win.show()
    app.exec_()
예제 #16
0
파일: status.py 프로젝트: koll00/Gui_SM
def test():
    from PyQt4.QtGui import QMainWindow
    from SMlib.utils.qthelpers import qapplication

    app = qapplication()
    win = QMainWindow()
    win.setWindowTitle("Status widgets test")
    win.resize(900, 300)
    statusbar = win.statusBar()
    swidgets = []
    for klass in (ReadWriteStatus, EOLStatus, EncodingStatus, CursorPositionStatus, MemoryStatus, CPUStatus):
        swidget = klass(win, statusbar)
        swidgets.append(swidget)
    win.show()
    app.exec_()
예제 #17
0
파일: texteditor.py 프로젝트: koll00/Gui_SM
def test():
    """Text editor demo"""
    from SMlib.utils.qthelpers import qapplication
    _app = qapplication()  # analysis:ignore
    dialog = TextEditor("""
    01234567890123456789012345678901234567890123456789012345678901234567890123456789
    dedekdh elkd ezd ekjd lekdj elkdfjelfjk e
    """)
    dialog.show()
    if dialog.exec_():
        text = dialog.get_value()
        print "Accepted:", text
        dialog = TextEditor(text)
        dialog.exec_()
    else:
        print "Canceled"
예제 #18
0
파일: texteditor.py 프로젝트: koll00/Gui_SM
def test():
    """Text editor demo"""
    from SMlib.utils.qthelpers import qapplication
    _app = qapplication()  # analysis:ignore
    dialog = TextEditor("""
    01234567890123456789012345678901234567890123456789012345678901234567890123456789
    dedekdh elkd ezd ekjd lekdj elkdfjelfjk e
    """)
    dialog.show()
    if dialog.exec_():
        text = dialog.get_value()
        print "Accepted:", text
        dialog = TextEditor(text)
        dialog.exec_()
    else:
        print "Canceled"
예제 #19
0
def oedit(obj, modal=True, namespace=None):
    """Edit the object 'obj' in a GUI-based editor and return the edited copy
    (if Cancel is pressed, return None)

    The object 'obj' is a container
    
    Supported container types:
    dict, list, tuple, str/unicode or numpy.array
    
    (instantiate a new QApplication if necessary,
    so it can be called directly from the interpreter)
    """
    # Local import
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    
    if modal:
        obj_name = ''
    else:
        assert isinstance(obj, basestring)
        obj_name = obj
        if namespace is None:
            namespace = globals()
        keeper.set_namespace(namespace)
        obj = namespace[obj_name]
        # keep QApplication reference alive in the Python interpreter:
        namespace['__qapp__'] = app
    
    result = create_dialog(obj, obj_name)
    if result is None:
        return
    dialog, end_func = result
    
    if modal:
        if dialog.exec_():
            return end_func(dialog)
    else:
        keeper.create_dialog(dialog, obj_name, end_func)
        import os
        qt_inputhook = os.environ.get("INSTALL_QT_INPUTHOOK",
                                      "").lower() == "true"
        if os.name == 'nt' and not qt_inputhook:
            app.exec_()
예제 #20
0
def oedit(obj, modal=True, namespace=None):
    """Edit the object 'obj' in a GUI-based editor and return the edited copy
    (if Cancel is pressed, return None)

    The object 'obj' is a container
    
    Supported container types:
    dict, list, tuple, str/unicode or numpy.array
    
    (instantiate a new QApplication if necessary,
    so it can be called directly from the interpreter)
    """
    # Local import
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()

    if modal:
        obj_name = ''
    else:
        assert isinstance(obj, basestring)
        obj_name = obj
        if namespace is None:
            namespace = globals()
        keeper.set_namespace(namespace)
        obj = namespace[obj_name]
        # keep QApplication reference alive in the Python interpreter:
        namespace['__qapp__'] = app

    result = create_dialog(obj, obj_name)
    if result is None:
        return
    dialog, end_func = result

    if modal:
        if dialog.exec_():
            return end_func(dialog)
    else:
        keeper.create_dialog(dialog, obj_name, end_func)
        import os
        qt_inputhook = os.environ.get("INSTALL_QT_INPUTHOOK",
                                      "").lower() == "true"
        if os.name == 'nt' and not qt_inputhook:
            app.exec_()
예제 #21
0
파일: explorer.py 프로젝트: koll00/Gui_SM
        label.setAlignment(Qt.AlignRight)
        hlayout3.addWidget(label)
        self.label3 = QLabel()
        hlayout3.addWidget(self.label3)
        self.explorer.sig_option_changed.connect(lambda x, y: self.label3.setText("option_changed: %r, %r" % (x, y)))

        self.connect(self.explorer, SIGNAL("open_parent_dir()"), lambda: self.explorer.listwidget.refresh(".."))


class ProjectExplorerTest(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        vlayout = QVBoxLayout()
        self.setLayout(vlayout)
        self.treewidget = FilteredDirView(self)
        self.treewidget.setup_view()
        self.treewidget.set_root_path(r"D:\Python")
        self.treewidget.set_folder_names(["spyder", "spyder-2.0"])
        vlayout.addWidget(self.treewidget)


if __name__ == "__main__":
    from SMlib.utils.qthelpers import qapplication

    app = qapplication()
    test = FileExplorerTest()
    #    test = ProjectExplorerTest()
    test.resize(640, 480)
    test.show()
    sys.exit(app.exec_())
예제 #22
0
파일: explorer.py 프로젝트: koll00/Gui_SM
        self.label3 = QLabel()
        hlayout3.addWidget(self.label3)
        self.explorer.sig_option_changed.connect(
            lambda x, y: self.label3.setText('option_changed: %r, %r' %
                                             (x, y)))

        self.connect(self.explorer, SIGNAL("open_parent_dir()"),
                     lambda: self.explorer.listwidget.refresh('..'))


class ProjectExplorerTest(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        vlayout = QVBoxLayout()
        self.setLayout(vlayout)
        self.treewidget = FilteredDirView(self)
        self.treewidget.setup_view()
        self.treewidget.set_root_path(r'D:\Python')
        self.treewidget.set_folder_names(['spyder', 'spyder-2.0'])
        vlayout.addWidget(self.treewidget)


if __name__ == "__main__":
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    test = FileExplorerTest()
    #    test = ProjectExplorerTest()
    test.resize(640, 480)
    test.show()
    sys.exit(app.exec_())