示例#1
0
import enaml
import pkg_resources
from datetime import datetime
from atom.api import Atom, Int, List, Unicode, Instance, Bool, Enum
from inkcut.core.api import Plugin, DockItem, log
from inkcut.core.utils import load_icon
from enaml.qt.q_resource_helpers import get_cached_qicon
from enaml.layout.api import AreaLayout, DockBarLayout, HSplitLayout
from enaml.application import timed_call

from . import extensions

with enaml.imports():
    from enaml.stdlib.dock_area_styles import available_styles

ALL_STYLES = sorted(['system']+available_styles())

class Clock(Atom):
    """ A clock so widgets can observe each field as required. """
    year = Int()
    month = Int()
    day = Int()
    hour = Int()
    minute = Int()
    second = Int()
    running = Bool(True)
    now = Instance(datetime, factory=lambda: datetime.now())

    def _observe_running(self, change):
        if self.running:
            timed_call(0, self.tick)
示例#2
0
文件: plugin.py 项目: ylwb/declaracad
Created on Jul 12, 2015

@author: jrm
"""
import enaml
from atom.api import Atom, List, Str, Instance, Dict, Enum
from declaracad.core.api import Plugin, DockItem, log

from enaml.layout.api import AreaLayout, DockBarLayout, HSplitLayout, TabLayout
from . import extensions

with enaml.imports():
    from enaml.stdlib.dock_area_styles import available_styles

ALL_STYLES = ['system'] + available_styles()


class DeclaracadPlugin(Plugin):
    #: Project site
    wiki_page = Str("https;//declaracad.com/")

    #: Dock items to add
    dock_items = List(DockItem)
    dock_layout = Instance(AreaLayout)
    dock_style = Enum(*reversed(ALL_STYLES)).tag(config=True)

    #: Settings pages to add
    settings_pages = List(extensions.SettingsPage)

    #: Current settings page
示例#3
0
import pkg_resources
from datetime import datetime
from atom.api import Atom, Int, List, Str, Instance, Bool, Enum, Dict
from enaml.qt.q_resource_helpers import get_cached_qicon
from enaml.layout.api import AreaLayout, DockBarLayout, HSplitLayout
from enaml.widgets.api import MenuBar
from enaml.application import timed_call

from inkcut.core.api import Plugin, DockItem, log
from inkcut.core.utils import load_icon
from . import extensions

with enaml.imports():
    from enaml.stdlib.dock_area_styles import available_styles

ALL_STYLES = sorted(['system'] + available_styles())


class Clock(Atom):
    """ A clock so widgets can observe each field as required. """
    year = Int()
    month = Int()
    day = Int()
    hour = Int()
    minute = Int()
    second = Int()
    running = Bool(True)
    now = Instance(datetime, factory=lambda: datetime.now())

    def _observe_running(self, change):
        if self.running: