Example #1
0
                   Item(name="margin"),
                   label="DataSet Property",
                   show_border=True),
            VGroup(Item(name="ds"), Item(name="either"),
                   Item(name="possible_stock_states"), Item(name="stock")),
            VGroup(Item(name="data", editor=ShellEditor()))),
        buttons=[OKButton, CancelButton],
        #statusbar = [StatusItem(name="title")],
        dock="vertical",
        title="Dataset Property",
        resizable=True,
        width=1000,
        height=600,
    )


def showUi():
    ds = DataSet()
    ds.configure_traits(kind="live")
    print(ds)


# add to menu
from imagect.api.actmgr import addActFun, renameAct

addActFun("help.example.traits", "Truits", index=1)(showUi)
renameAct("help.example", "Example")

if __name__ == "__main__":
    showUi()
Example #2
0
    def __init__(self):
        self._id = "reader.gray.2d"
        self._suffix = ["jpg", "png", "bmp"]

    def id(self) -> str:
        return self._id

    def suffix(self) -> List[str]:
        return self._suffix

    def name(self) -> str:
        return self._name.str()

    def category(self) -> str:
        return self._category

    def read(path: str):
        """
        read in a image
        """
        pass


@addActFun("help.traits.traitui", "show trait ui", index=1, shortcut="F4")
def testRecent(index=0):
    reader = Gray2dImageReader()
    reader.configure_traits()


renameAct("help.traits", "Traits", index=12)
Example #3
0
def get():
    return getUtility(IMainWin)


@addActFun("file.exit", text="&Exit", index=10)
def appexit():
    app.get().exit()


@addActFun("file.exampe.msg", text="&Message", index=1)
def apptest():
    win = get()
    win.showMessage("Test Message")


@addActWdg("file.exampe.wdg", text="Show Widget", index=3)
class ActWdg(QSpinBox):
    def __init__(self, parent):
        super().__init__(parent)


@addActFun("file.exampe.print", text="Print Actions", index=4)
def appPrint():
    mngr = imagect.api.actmgr.get()
    acts = mngr.queryAll()
    for a in acts:
        print("id={}, title={}".format(a.id, a.title))


renameAct("file.exampe", "Examples", index=12)
Example #4
0
        """
        getWin().console()._control.clear()

    def printText(self, text: str):
        """
        show text in console
        """
        s = "print({})".format(text)
        self.execute(s)

    def execute(self, command):
        """
        execute python statement in console
        """
        import PyQt5.QtWidgets
        # PyQt5.QtWidgets.QApplication.clipboard().setText(command)
        # getWin().console().paste()
        # getWin().console()._append_plain_text(command)
        getWin().console().execute(source=command)


from imagect.api.actmgr import addActFetch, addActFun, renameAct


@addActFun("help.console.welcome", "welcome message", index=1)
def testRecent():
    get().printText("welcome")


renameAct("help.console", "Console", index=11)
Example #5
0
            ds.meta.path = pro.path
            ds.meta.reader = VolReader.__class__ #.name
            ds.meta.category = "vol"
            return ds
        return None

# add to menu

import imagect.api.dataset as ds
from imagect.api.actmgr import addActFun, renameAct
@addActFun("file.open.vol", "Raw Image", index =1, shortcut="F11")
def newimage() :
    sample = VolReader.readFrom(None)
    if sample is None :
        return

    ds.get().add(sample)

    import imagect.api.viewmgr as vm

    sm = vm.get()
    if sm :
        sm.insertVolSession(sample)

renameAct("file.open", "Open")

if __name__ == "__main__":
    # VolReader.read()
    vr = VolReader()
    vr.read("")
Example #6
0
    def getFiles(self) -> List[str]:
        """
        return a list a files
        """
        return [r.path for r in self._files]


@addActFetch("file.recent", "Recent File", index=2)
def recentMenu(qact: QObject):
    files = recent.get().getFiles()
    return [QAction(f, qact) for f in files]


g = 0


@addActFun("help.recent.add", "Add Recent File", index=1, shortcut="F2")
def testRecent():
    global g
    filename = "file-{}".format(g)
    g += 1
    recent.get().push(filename)


@addActFun("help.recent.clear", "Clear Recent File", index=1)
def testRecent(index=0):
    recent.get().clear()


renameAct("help.recent", "Recent", index=12)