Exemple #1
0
 def __init__(self):
     super(AboutWindow, self).__init__('GB3 - ' + _T('About'),
                                       ID=0, # no position remembering
                                       Position=('centered', 'centered'),
                                       CloseOnReq=True)
     root = pymui.VGroup()
     self.RootObject = root
     
     top = pymui.HGroup()
     root.AddChild(top)
     
     root.AddChild(pymui.HBar(0))
     
     okbt = pymui.SimpleButton(_T('Ok'))
     okbt.Notify('Pressed', lambda *a: self.CloseWindow(), when=False)
     root.AddChild(pymui.HCenter(okbt))
     
     top.AddChild(pymui.Dtpic('PROGDIR:data/internal/app_logo.png', InnerLeft=6, InnerRight=6))
     top.AddChild(pymui.Text(about_msg.safe_substitute(base=BASE,
                                                  description=DESCRIPTION,
                                                  version=main.VERSION,
                                                  build=main.BUILD,
                                                  date=main.DATE,
                                                  copyright=COPYRIGHT),
                             Frame='Text'))
Exemple #2
0
    def __init__(self):
        super(AssignICCWindow, self).__init__(_T("Assign Profile"),
                                              CloseOnReq=True)

        self._profiles = profile.Profile.get_all()

        top = pymui.VGroup()
        self.RootObject = top

        self._radio_grp = pymui.VGroup(GroupTitle=_T("Assign Profile") + ':')
        self._cb = pymui.Cycle(map(str, self._profiles),
                               CycleChain=True,
                               Disabled=True)
        self._cb.Notify('Active', self._on_profile_active)
        self._radio_grp.AddTail(self._cb)

        top.AddChild(self._radio_grp)

        top.AddChild(pymui.HBar(0))
        grp = pymui.HGroup()
        top.AddChild(grp)

        grp.AddChild(pymui.HSpace(0))
        bt = pymui.SimpleButton(_T("Assign"), CycleChain=True)
        grp.AddChild(bt)
Exemple #3
0
        def new_color(parent, label, color):
            rgb = pymui.c_ULONG.ArrayType(3)(*tuple(
                int(x * 255) * 0x01010101 for x in color[:3]))
            field = pymui.Colorfield(CycleChain=True,
                                     InputMode='RelVerify',
                                     Frame='ImageButton',
                                     FixWidth=64,
                                     RGB=rgb)
            cadj = pymui.Coloradjust(CycleChain=True, RGB=rgb)
            bt = pymui.SimpleButton(_T("Close"), CycleChain=True)
            grp = pymui.VGroup(Frame='Group')
            grp.AddChild(cadj)
            grp.AddChild(bt)
            popup = pymui.Popobject(Button=field, Object=grp)
            alpha = pymui.Numericbutton(CycleChain=True,
                                        Min=0,
                                        Max=100,
                                        Default=100,
                                        Value=int(color[3] * 100),
                                        Format="%lu%%",
                                        ShortHelp=_T("Transparency level"))
            cadj.Notify('RGB', lambda evt: field.SetAttr('RGB', evt.value))
            bt.Notify('Pressed', lambda evt: popup.Close(0), when=False)

            parent.AddChild(pymui.Label(_T(label) + ':'))
            parent.AddChild(popup)
            parent.AddChild(alpha)
            return field, alpha
Exemple #4
0
    def __init__(self):
        super(ConvertICCWindow, self).__init__(_T("Convert to Profile"),
                                               CloseOnReq=True)

        self._profiles = profile.Profile.get_all()

        top = pymui.VGroup()
        self.RootObject = top

        grp = pymui.VGroup(GroupTitle=_T("Source") + ':')
        top.AddChild(grp)

        self._cur_label = pymui.Text()
        grp.AddChild(self._cur_label)

        grp = pymui.VGroup(GroupTitle=_T("Destination") + ':')
        top.AddChild(grp)

        hgrp = pymui.HGroup()
        grp.AddChild(hgrp)

        hgrp.AddChild(pymui.Text(_T("Profile") + ': '))

        self._pro_cycle = pymui.Cycle(map(str, self._profiles),
                                      CycleChain=True)
        hgrp.AddTail(self._pro_cycle)

        grp = pymui.VGroup(GroupTitle=_T("Options") + ':')
        top.AddChild(grp)

        self._intents = profile.INTENTS.keys()
        cycle = pymui.Cycle(self._intents)
        cycle.Notify('Active', self._on_intent_active)

        hgrp = pymui.HGroup()
        grp.AddChild(hgrp)

        hgrp.AddChild(pymui.Text(_T("Intent") + ': '))
        hgrp.AddChild(cycle)
        """
        bt1 = gtk.CheckButton(_T("Use Black Point Compensation")+': ')
        bt2 = gtk.CheckButton(_T("Use Dither")+': ')
        bt3 = gtk.CheckButton(_T("Flatten Image")+': ')
        if len(docproxy.document.layers) == 1:
            bt3.set_sensitive(False)

        vbox.pack_start(bt1)
        vbox.pack_start(bt2)
        vbox.pack_start(bt3)

        self.show_all()
        """

        top.AddChild(pymui.HBar(0))
        grp = pymui.HGroup()
        top.AddChild(grp)

        grp.AddChild(pymui.HSpace(0))
        bt = pymui.SimpleButton(_T("Convert"), CycleChain=True)
        grp.AddChild(bt)
Exemple #5
0
    def __init__(self, min, max, default=None, cb=None, cb_args=(), islog=False, **kwds):
        super(FloatValue, self).__init__(Horiz=True, **kwds)

        if default is None:
            default = min

        assert min < max and min <= default and max >= default

        self.islog = islog
        self._min = min
        self._max = max
        self._range = (max - min)/1000.
        self._default = default

        self._cb = cb
        self._cb_args = cb_args

        self._value = pymui.String(MaxLen=7, Accept="0123456789.", Format='r', FixWidthTxt="-##.###",
                                   Frame='String', Background=None, CycleChain=True)
        self._value.Notify('Acknowledge', self.OnStringValue)
        self._slider = FloatSlider(self._min, self._range, islog)
        self._slider.Notify('Value', self.OnSliderValue)
        self.AddChild(self._value, self._slider)
        
        reset = pymui.SimpleButton(_T('R'), ShortHelp=_T('Reset value'), CycleChain=True, Weight=0)
        self.AddChild(reset)
        
        reset.Notify('Pressed', lambda *a: self.SetDefault())
        
        del self.value
Exemple #6
0
    def __init__(self, name):
        super(LayerMgr, self).__init__(ID='LayerMgr',
                                       Title=name,
                                       CloseOnReq=True)
        self.name = name

        self.__layctrllist = []
        self._active = None

        top = pymui.VGroup()
        self.RootObject = top

        self.layctrl_grp = pymui.VGroupV(Frame='Virtual',
                                         Spacing=VIRT_GROUP_SPACING)
        self.__space = pymui.VSpace(0)
        self.layctrl_grp.AddTail(self.__space)

        # Layer info group
        layerinfo = pymui.ColGroup(2)
        layerinfo.AddChild(pymui.Label(_T("Blending") + ':'))
        self.blending = pymui.Cycle(model.Layer.OPERATORS_LIST,
                                    CycleChain=True,
                                    ShortHelp=_T("Set layer's blending mode"))
        layerinfo.AddChild(self.blending)
        layerinfo.AddChild(pymui.Label(_T("Opacity") + ':'))
        self.opacity = pymui.Slider(Value=100,
                                    Format='%u%%',
                                    CycleChain=True,
                                    ShortHelp=_T("Set layer's opacity value"))
        layerinfo.AddChild(self.opacity)

        # Layer management buttons
        btn_grp = pymui.ColGroup(4)
        self.btn = {}
        for name, label in [
            ('add', 'Add'),
            ('del', 'Del'),
            ('dup', 'Copy'),
            ('merge', 'Merge'),
            ('up', 'Up'),
            ('down', 'Down'),
            ('top', 'Top'),
            ('bottom', 'Bottom'),
        ]:
            o = self.btn[name] = pymui.SimpleButton(label)
            btn_grp.AddChild(o)

        sc_gp = pymui.Scrollgroup(Contents=self.layctrl_grp, FreeHoriz=False)
        self.__vertbar = sc_gp.VertBar.object
        top.AddChild(sc_gp)
        top.AddChild(pymui.HBar(0))
        top.AddChild(layerinfo)
        top.AddChild(pymui.HBar(0))
        top.AddChild(pymui.HCenter(btn_grp))
Exemple #7
0
    def _do_page_inputs(self, reg):
        self._event_types = map(str, contexts.ALL_EVENT_TYPES)
        top = self._grp_inputs = pymui.HGroup()
        reg.AddChild(self._grp_inputs)

        # List of contexts
        self._ctx_names = sorted(contexts.ALL_CONTEXTS.keys())
        self._list_ctx = o = pymui.List(Title=pymui.MUIX_B + _T('Contexts'),
                                        SourceArray=self._ctx_names,
                                        Frame='ReadList',
                                        CycleChain=True,
                                        AdjustWidth=True)
        top.AddChild(pymui.Listview(List=o, Input=False))

        # List of currents bindings
        g = pymui.VGroup(GroupTitle=pymui.MUIX_B +
                         _T('Bindings on selected context'))
        top.AddChild(g)

        self._bt_new = pymui.SimpleButton(_T('Add binding'), CycleChain=True)
        g.AddChild(self._bt_new)

        self._ctx_page_grp = pymui.VGroup(PageMode=True)
        g.AddChild(self._ctx_page_grp)

        self._ctx_pages = {}

        def add_ctx_page(name):
            page = pymui.VGroup(GroupTitle=name)
            page.vg = pymui.VGroupV()
            page.vg.AddChild(pymui.HVSpace())
            page.vgp = pymui.Scrollgroup(Contents=page.vg, FreeHoriz=False)
            page.ctx = contexts.ALL_CONTEXTS[name]
            page.bindings = {}

            page.AddChild(page.vgp)

            self._ctx_page_grp.AddChild(page)
            self._ctx_pages[name] = page

        for name in self._ctx_names:
            add_ctx_page(name)

        # Notifications
        self._list_ctx.Notify('Active', self._on_ctx_active)
        self._bt_new.Notify('Pressed', self._on_new_bind, when=False)
Exemple #8
0
 def __init__(self, name):
     super(Splash, self).__init__(ID=0,
                                  CloseOnReq=True,
                                  Borderless=True,
                                  DragBar=False,
                                  CloseGadget=False,
                                  SizeGadget=False,
                                  DepthGadget=False,
                                  Opacity=230,
                                  Position=('centered', 'centered'))
     self.name = name
     
     # Special root group with window auto-close on any events
     root = MyRoot(Frame='None',
                   Background='2:00000000,00000000,00000000',
                   InnerSpacing=(0,)*4)
     self.RootObject = root
     
     top_bar = pymui.HGroup(
         Frame='None',
         Background='5:PROGDIR:data/internal/splash_header.png')
     self.bottom_bar = bottom_bar = pymui.VGroup(Frame='None', InnerBottom=6)
     
     top_bar.AddChild(pymui.Dtpic('PROGDIR:data/internal/app_logo.png', InnerLeft=6, InnerRight=6))
     top_bar.AddChild(pymui.HSpace(0))
     top_bar.AddChild(pymui.Text(Frame='None',
                                 HorizWeight=0,
                                 PreParse=pymui.MUIX_C+pymui.MUIX_PH,
                                 Font=pymui.MUIV_Font_Tiny,
                                 Contents='v%.1f.%d\n%s' % (main.VERSION, main.BUILD, main.STATUS)))
     
     #hg = pymui.HGroup(InnerLeft=6, InnerRight=6)
     #bottom_bar.AddChild(hg)
     
     #hg.AddChild(pymui.Text(Frame='None', InnerLeft=6,
     #                       SetMax=True, PreParse=pymui.MUIX_PH,
     #                       Contents=_T('Interaction')+':'))
     #cycle = pymui.Cycle(['User', 'Default'], HorizWeight=0)
     
     #hg.AddChild(cycle)
     #hg.AddChild(pymui.HSpace(0))
     
     recent_gp = pymui.VGroup(InnerLeft=6, InnerRight=6)
     bottom_bar.AddChild(recent_gp)
             
     self.lasts_bt = []
     if os.path.isfile(LASTS_FILENAME):
         recent_gp.AddChild(pymui.Text(Frame='None',
                            InnerLeft=6, InnerRight=6,
                            PreParse=pymui.MUIX_L+pymui.MUIX_PH,
                            Contents=_T('Recent')+':'))
         with open(LASTS_FILENAME) as fd:
             for i in xrange(5):
                 path = fd.readline()[:-1]
                 if path:
                     logo = pymui.Dtpic('SYS:Prefs/Presets/Deficons/image/default.info',
                                        Scale=32, InnerLeft=20)
                     text = pymui.Text(Frame='None',
                                       PreParse=pymui.MUIX_PH,
                                       InputMode='RelVerify',
                                       Contents=os.path.basename(path))
                     text.path = path
                     
                     hg = pymui.HGroup()
                     hg.AddChild(logo)
                     hg.AddChild(text)
                     recent_gp.AddChild(hg)
                     
                     self.lasts_bt.append(text)
                     
     bottom_bar.AddChild(pymui.HBar(1))
     
     bt = pymui.SimpleButton(_T('About'), Weight=0, InnerRight=6)
     bt.Notify('Pressed', lambda *a: pymui.GetApp().about.OpenWindow(), when=False)
     bottom_bar.AddChild(pymui.HGroup(Child=(pymui.HSpace(0), bt)))
     
     all_logos = glob.glob('data/internal/app_intro*.png')
     logo = pymui.Dtpic(random.choice(all_logos), Frame="Group")
     
     root.AddChild(top_bar)
     root.AddChild(logo)
     root.AddChild(bottom_bar)
Exemple #9
0
    def __init__(self, name):
        super(ColorHarmoniesWindow, self).__init__(ID='CHRM',
                                                   Title=name,
                                                   CloseOnReq=True)
        self.name = name

        self.RootObject = top = pymui.VGroup()
        self.widgets = {}

        self.colorwheel = ColorWeelHarmonies2()        
        top.AddChild(pymui.HCenter(self.colorwheel))

        self.hue = pymui.Slider(Min=0, Max=360, CycleChain=True)
        self.sat = pymui.Slider(Min=0, Max=100, CycleChain=True)
        self.value = pymui.Slider(Min=0, Max=100, CycleChain=True)
        
        self.red = pymui.Slider(Min=0, Max=255, CycleChain=True)
        self.green = pymui.Slider(Min=0, Max=255, CycleChain=True)
        self.blue = pymui.Slider(Min=0, Max=255, CycleChain=True)

        self.colorbox = ColorBox(Frame='Virtual', MaxWidth=16)

        grp = pymui.HGroup()
        grp.AddChild(self.colorbox)
        grp.AddChild(pymui.ColGroup(2, Child=(pymui.Label(_T('Red')+':'), self.red,
                                       pymui.Label(_T('Green')+':'), self.green,
                                       pymui.Label(_T('Blue')+':'), self.blue,
                                       pymui.Label(_T('Hue')+':'), self.hue,
                                       pymui.Label(_T('Saturation')+':'), self.sat,
                                       pymui.Label(_T('Value')+':'), self.value)))
        top.AddChild(grp)                

        bt = pymui.SimpleButton(_T("Use as background"), CycleChain=True)
        top.AddChild(bt)
        self.widgets['AsBgBt'] = bt
        
        top.AddChild(pymui.HBar(3))
        
        toggle_pal = pymui.Text(_T("Toggle Palette panel"),
                                InputMode='Toggle',
                                Frame='Button',
                                Background='ButtonBack',
                                Font=pymui.MUIV_Font_Button,
                                PreParse=pymui.MUIX_C,
                                Selected=True)
        top.AddChild(toggle_pal)
        
        grp = pymui.VGroup(GroupTitle=_T('Palette'))
        top.AddChild(grp)
        
        toggle_pal.Notify('Selected', lambda evt: grp.SetAttr('ShowMe', evt.value.value))
        
        ld_pal = pymui.SimpleButton(_T("Load"), CycleChain=True)
        sv_pal = pymui.SimpleButton(_T("Save"), CycleChain=True)
        del_pal = pymui.SimpleButton(_T("Delete"), CycleChain=True)
        grp.AddChild(pymui.HGroup(Child=(ld_pal, sv_pal, del_pal)))
        
        self._predefpallister = pymui.List(SourceArray=self.palettes_list)
        pal_name_bt = pymui.Text(Frame='Text', CycleChain=True, ShortHelp=_T('Predefined palettes'))
        popup = pymui.Popobject(Object=pymui.Listview(List=self._predefpallister),
                                String=pal_name_bt,
                                Button=pymui.Image(Frame='ImageButton',
                                                   Spec=pymui.MUII_PopUp,
                                                   InputMode='RelVerify',
                                                   CycleChain=True))
                                                     
        grp.AddChild(pymui.HGroup(Child=(pymui.Label(_T('Avails')+':'), popup)))
        sort_luma = pymui.SimpleButton(_T('Luminance'), CycleChain=True)
        sort_hue = pymui.SimpleButton(_T('Hue'), CycleChain=True)
        sort_sat = pymui.SimpleButton(_T('Saturation'), CycleChain=True)
        sort_value = pymui.SimpleButton(_T('Value'), CycleChain=True)
        grp.AddChild(pymui.HGroup(Child=(pymui.Label(_T('Sort by')+':'), sort_luma, sort_hue, sort_sat, sort_value)))
        grp.AddChild(pymui.HBar(0))
        
        vgrp = pymui.VGroup(SameSize=True, Columns=16, Spacing=1, HorizWeight=100, Horiz=False, Background='2:00000000,00000000,00000000')
        grp.AddChild(pymui.HCenter(vgrp))
        self._pal_bt = []
        for i in xrange(256):
            bt = DropColorBox(12, 12)
            vgrp.AddChild(bt)
            bt.Notify('Pressed', self._on_palbt, when=False)
            self._pal_bt.append(bt)

        # Notifications        
        self.hue.Notify('Value', lambda evt: self._set_hsv_channel(evt.value.value / 360., 0))
        self.sat.Notify('Value', lambda evt: self._set_hsv_channel(evt.value.value / 100., 1))
        self.value.Notify('Value', lambda evt: self._set_hsv_channel(evt.value.value / 100., 2))
        
        self.red.Notify('Value', lambda evt: self._set_rgb_channel(evt.value.value / 255., 0))
        self.green.Notify('Value', lambda evt: self._set_rgb_channel(evt.value.value / 255., 1))
        self.blue.Notify('Value', lambda evt: self._set_rgb_channel(evt.value.value / 255., 2))

        ld_pal.Notify('Pressed', self._on_ld_pal_pressed, when=False)
        sv_pal.Notify('Pressed', self._on_sv_pal_pressed, when=False)
        del_pal.Notify('Pressed', self._on_del_pal_pressed, when=False)

        self._predefpallister.Notify('DoubleClick', self._on_popup_predef_sel, popup)
        self._predefpallister.Notify('Active', self._on_predef_list_active, pal_name_bt, del_pal)
        
        sort_luma.Notify('Pressed', lambda evt, cmp: self.sort_palette(cmp), self._cmp_luma, when=False)
        sort_hue.Notify('Pressed', lambda evt, cmp: self.sort_palette(cmp), self._cmp_hue, when=False)
        sort_sat.Notify('Pressed', lambda evt, cmp: self.sort_palette(cmp), self._cmp_sat, when=False)
        sort_value.Notify('Pressed', lambda evt, cmp: self.sort_palette(cmp), self._cmp_value, when=False)
        
        # final setup
        self._use_palette('default')
        
        toggle_pal.Selected = False # start in no palette mode
Exemple #10
0
    def __init__(self):
        super(AppPrefWindow, self).__init__(_T("Application Preferences"),
                                            ID='PREFS',
                                            CloseOnReq=True,
                                            NoMenus=True)

        top = pymui.VGroup()
        self.RootObject = top

        g = pymui.HGroup()
        top.AddChild(g)

        lister = pymui.Listview(List=pymui.List(SourceArray=[
            _T("Rendering"),
            _T("Events binding"),
            _T("Tools wheel"),
            _T("Calibration"),
            _T("Miscellaneous")
        ],
                                                Frame='ReadList',
                                                CycleChain=True,
                                                AdjustWidth=True),
                                Input=False)
        g.AddChild(lister)

        self._pager = pymui.VGroup(PageMode=True)
        g.AddChild(self._pager)

        # Fill pages
        self._do_page_rendering(self._pager)
        self._do_page_inputs(self._pager)
        self._do_page_toolswheel(self._pager)
        self._do_page_calibration(self._pager)
        self._do_page_misc(self._pager)

        # Bottom buttons
        top.AddChild(pymui.HBar(4))
        grp = pymui.HGroup()
        top.AddChild(grp)

        bt_save = pymui.SimpleButton(_T("Save and close"), CycleChain=True)
        bt_apply = pymui.SimpleButton(_T("Apply"), CycleChain=True)
        bt_def = pymui.SimpleButton(_T("Reset to Defaults"), CycleChain=True)
        bt_revert = pymui.SimpleButton(_T("Revert"), CycleChain=True)
        grp.AddChild(bt_save, bt_apply, bt_def, bt_revert)

        bt_save.Notify('Pressed', self._on_save, when=False)
        bt_apply.Notify('Pressed', self.apply_config, when=False)
        bt_def.Notify('Pressed', self.use_defaults, when=False)
        bt_revert.Notify('Pressed', self.init_from_prefs, when=False)

        def callback(evt):
            self._pager.ActivePage = evt.value.value

        lister.Notify('Active', callback)
        lister.Active = 0

        # Register prefs handlers
        prefs.register_tag_handler('bindings', _BindingsPrefHandler())
        prefs.register_tag_handler('toolswheel', _ToolsWheelPrefHandler())
        prefs.register_tag_handler('metrics', _MetricsPrefHandler())
        prefs.register_tag_handler('rendering', _RenderingPrefHandler())
        prefs.register_tag_handler('interface', _InterfacePrefHandler())
Exemple #11
0
    def __init__(self, name):
        super(BrushHouseWindow, self).__init__(name,
                                               ID='BRHO',
                                               LeftEdge=0,
                                               TopDeltaEdge=0,
                                               CloseOnReq=True)
        self.name = name

        self._brushes = set()
        self._all = None
        self._current = None
        self._pages = []
        self._drawbrush = DrawableBrush()  # used for preview

        # UI
        self._top = topbox = self.RootObject = pymui.VGroup()

        # Brush context menu
        self._brushmenustrip = pymui.Menustrip()
        menu = pymui.Menu(_T('Brush actions'))
        self._brushmenustrip.AddTail(menu)

        self._menuitems = {}
        for k, text in [('use-preview-icon', _T('Use preview icon')),
                        ('use-image-icon', _T('Use image icon')),
                        ('change-icon', _T('Change image icon...')),
                        ('as-eraser', _T('As eraser brush...')),
                        ('dup', _T('Duplicate')), ('delete', _T('Delete'))]:
            o = self._menuitems[k] = pymui.Menuitem(text)
            menu.AddChild(o)

        # Pages controls
        box = pymui.HGroup()
        topbox.AddChild(box)

        bt = pymui.SimpleButton(_T('New page'), Weight=0)
        box.AddChild(bt)
        bt.Notify('Pressed', self._on_add_page, when=False)

        bt = self._del_page_bt = pymui.SimpleButton(_T('Delete page'),
                                                    Weight=0,
                                                    Disabled=True)
        box.AddChild(bt)
        bt.Notify('Pressed', self._on_del_page, when=False)

        bt = pymui.SimpleButton(_T('New brush'), Weight=0)
        box.AddChild(bt)
        bt.Notify('Pressed', self._on_new_brush, when=False)

        bt = pymui.SimpleButton(_T('Save all'), Weight=0)
        box.AddChild(bt)
        bt.Notify('Pressed', self._on_save_all, when=False)

        box.AddChild(pymui.HSpace(0))

        # Notebook
        nb = self._nb = pymui.VGroup(Frame='Register',
                                     PageMode=True,
                                     Background='RegisterBack',
                                     CycleChain=True,
                                     muiargs=[(MUIA_Group_PageMax, False)])
        self._titles = pymui.Title(Closable=False, Newable=False)
        nb.AddChild(self._titles)
        nb.Notify('ActivePage', self._on_active_page)
        topbox.AddChild(nb)

        self._pagenamebt = pymui.String(Frame='String',
                                        Background='StringBack',
                                        Disabled=True,
                                        CycleChain=True)
        self._pagenamebt.Notify('Acknowledge',
                                lambda ev, v: self._change_page_name(v),
                                pymui.MUIV_TriggerValue)

        self._brushnamebt = pymui.Text(Frame='String', PreParse=pymui.MUIX_C)

        grp = pymui.HGroup(Child=[
            pymui.Label(_T('Page name') + ':'), self._pagenamebt,
            pymui.Label(_T('Active brush') + ':'), self._brushnamebt
        ])
        topbox.AddChild(grp)

        # Add the 'All brushes' page
        self._all = self.add_page(_T('All brushes'), close=False)

        self._del_page_bt.Disable = True
        if len(self._brushes) == 1:
            self._menuitems['delete'].Enabled = False
Exemple #12
0
    def __init__(self, name):
        super(DocInfoWindow, self).__init__(name, ID='INFO', CloseOnReq=True)
        self.name = name

        top = pymui.VGroup()
        self.RootObject = top

        # Document name
        name = pymui.Text(Frame='Text')
        top.AddChild(name)

        # Dimensions
        dim_grp = pymui.VGroup(GroupTitle=_T("Dimensions"))
        use_full_bt = pymui.SimpleButton(_T("No limits"), CycleChain=True)
        use_cur_bt = pymui.SimpleButton(_T("Set to current size"),
                                        CycleChain=True)
        ori_x = pymui.String(Frame='String',
                             Accept="-0123456789",
                             CycleChain=True)
        ori_y = pymui.String(Frame='String',
                             Accept="-0123456789",
                             CycleChain=True)
        size_x = pymui.String(Frame='String',
                              Accept="-0123456789",
                              CycleChain=True)
        size_y = pymui.String(Frame='String',
                              Accept="-0123456789",
                              CycleChain=True)

        box = pymui.ColGroup(2)
        box.AddChild(pymui.Label(_T("X Origin") + ':'))
        box.AddChild(ori_x)
        box.AddChild(pymui.Label(_T("Y Origin") + ':'))
        box.AddChild(ori_y)
        box.AddChild(pymui.Label(_T("Width") + ':'))
        box.AddChild(size_x)
        box.AddChild(pymui.Label(_T("Height") + ':'))
        box.AddChild(size_y)

        ori_x.Notify('Acknowledge', self._modify_dim, 0)
        ori_y.Notify('Acknowledge', self._modify_dim, 1)
        size_x.Notify('Acknowledge', self._modify_dim, 2)
        size_y.Notify('Acknowledge', self._modify_dim, 3)

        pp = pymui.Text(_T("Passe-Partout"),
                        InputMode='Toggle',
                        Frame='Button',
                        Background='ButtonBack',
                        PreParse=pymui.MUIX_C,
                        Selected=False)
        pp.Notify('Selected', self._toggle_pp)
        dim_grp.AddChild(pp)

        dim_grp.AddChild(pymui.HGroup(Child=(use_full_bt, use_cur_bt)))
        dim_grp.AddChild(box)
        top.AddChild(dim_grp)

        def callback(evt):
            self.__docproxy.set_metadata(dimensions=None)

        use_full_bt.Notify('Pressed', callback, when=False)

        def callback(evt):
            _, _, w, h = area = self.__docproxy.document.area
            if not (w and h):
                area = None
            self.__docproxy.set_metadata(dimensions=area)

        use_cur_bt.Notify('Pressed', callback, when=False)

        # Density
        dpi_grp = pymui.VGroup(GroupTitle=_T("Density"))
        use_calib_bt = pymui.SimpleButton(_T("Set from calibration"),
                                          CycleChain=True)
        dpi_x = pymui.String(Frame='String',
                             Accept="0123456789.",
                             CycleChain=True)
        dpi_y = pymui.String(Frame='String',
                             Accept="0123456789.",
                             CycleChain=True)

        box = pymui.ColGroup(2)
        box.AddChild(pymui.Label(_T("X") + ':'))
        box.AddChild(dpi_x)
        box.AddChild(pymui.Label(_T("Y") + ':'))
        box.AddChild(dpi_y)

        dpi_grp.AddChild(use_calib_bt)
        dpi_grp.AddChild(box)
        top.AddChild(dpi_grp)

        def callback(evt):
            dpi_x = Ruler.METRICS['in'][2]
            dpi_y = Ruler.METRICS['in'][3]
            self.__docproxy.set_metadata(densities=[dpi_x, dpi_y])

        use_calib_bt.Notify('Pressed', callback, when=False)

        self.widgets = {
            'name': name,
            'dpi-x': dpi_x,
            'dpi-y': dpi_y,
            'dim-x': size_x,
            'dim-y': size_y,
            'ori-x': ori_x,
            'ori-y': ori_y,
        }