def populateBookmarks(self):
        con = Icon(self,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        con.standard_set("folder_home")
        con.show()

        it = self.bookmarksList.item_append("Home", icon=con)
        it.data["path"] = self.home

        con = Icon(self,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        con.standard_set("drive-harddisk")
        con.show()

        it = self.bookmarksList.item_append("Root", icon=con)
        it.data["path"] = self.root

        it = self.bookmarksList.item_append("")
        it.separator_set(True)

        for bk in self.getGTKBookmarks():
            con = Icon(self,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)
            con.standard_set("gtk-directory")
            con.show()
            it = self.bookmarksList.item_append(bk.split("/")[-1], icon=con)
            it.data["path"] = bk[7:]
Beispiel #2
0
    def content_get(self, obj, part, data):
        checked = data[1]

        # "edit" EDC layout is like below. each part is swallow part.
        # the existing item is swllowed to elm.swallow.edit.content part.
        # --------------------------------------------------------------------
        # | elm.edit.icon.1 | elm.swallow.decorate.content | elm.edit.icon,2 |
        # --------------------------------------------------------------------

        if part == "elm.swallow.end":
            ic = Icon(obj,
                      file=os.path.join(img_path, "bubble.png"),
                      size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
            return ic
        elif part == "elm.edit.icon.1":
            ck = Check(obj, state=checked, propagate_events=False)
            ck.show()
            return ck
        elif part == "elm.edit.icon.2":
            icn = Icon(obj,
                       file=os.path.join(img_path, "icon_06.png"),
                       propagate_events=False,
                       size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
            icn.callback_clicked_add(edit_icon_clicked_cb, data)
            return icn
        else:
            return
Beispiel #3
0
def DeepIcon(parent, name, size):
    global _cachedPaths
    if _cachedPaths == None:
        _cachedPaths = {}
        _createCachedPaths()

    ic = None

    try:
        ic = Icon(parent, standard=name, order_lookup=ELM_ICON_LOOKUP_FDO_THEME, \
                  size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1), \
                  size_hint_min=(size,size))
    except:
        try:
            ic = Icon(parent, standard=_coerceIcon(name,size), order_lookup=ELM_ICON_LOOKUP_FDO_THEME, \
                      size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1), \
                      size_hint_min=(size,size))
        except:
            try:
                ic = Icon(parent, standard='image-missing', order_lookup=ELM_ICON_LOOKUP_FDO_THEME, \
                          size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1), \
                          size_hint_min=(size,size))
            except:
                try:
                    ic = Icon(parent, standard=_coerceIcon('image-missing',size), order_lookup=ELM_ICON_LOOKUP_FDO_THEME, \
                              size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1), \
                              size_hint_min=(size,size))
                except:
                    ic = Icon(parent, standard='close', order_lookup=ELM_ICON_LOOKUP_FDO_THEME, \
                              size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1), \
                              size_hint_min=(size,size))

    return ic
Beispiel #4
0
def photo_object_add(parent, ic, icon, x, y, w, h, angle):
    po = Photo_Object()
    po.base_zoom = po.zoom = BASE_ZOOM

    if ic:
        po.ic = ic
    else:
        po.ic = Icon(parent)
        po.ic.file = icon

    po.bx = x
    po.by = y
    po.bw = w
    po.bh = h

    # Add shadow
    po.shadow = Icon(po.ic, file=os.path.join(img_path, "pol_shadow.png"))
    po.shadow.size = SHADOW_W, SHADOW_H
    po.shadow.show()

    po.hit = Polygon(parent.evas)
    po.hit.precise_is_inside = True
    po.hit.repeat_events = True
    po.hit.color = 0, 0, 0, 0

    po.ic.pos = 0, 0
    po.ic.size = po.bw, po.bh
    po.ic.show()

    po.hit.show()

    po.gl = GestureLayer(po.ic, hold_events=True)
    po.gl.attach(po.hit)

    # FIXME: Add a po.rotate start so we take the first angle!!!!
    po.gl.cb_set(ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_MOVE, rotate_move, po)
    po.gl.cb_set(ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_END, rotate_end, po)
    po.gl.cb_set(ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_ABORT, rotate_end, po)
    po.gl.cb_set(ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_START, zoom_start, po)
    po.gl.cb_set(ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE, zoom_move, po)
    po.gl.cb_set(ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_END, zoom_end, po)
    po.gl.cb_set(ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_ABORT, zoom_end, po)
    po.gl.cb_set(ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_START, momentum_start,
                 po)
    po.gl.cb_set(ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_MOVE, momentum_move,
                 po)
    po.gl.cb_set(ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_END, momentum_end, po)
    po.gl.cb_set(ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_ABORT, momentum_end,
                 po)

    po.rotate = po.base_rotate = angle
    po.shadow_zoom = 1.3

    apply_changes(po)
    return po
    def populate_bookmarks(self):
        '''Fill Bookamrks List'''
        con = Icon(self,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        con.standard_set('document-open-recent')
        con.show()
        cur_item = self.bookmarks_lst.item_append('Recent', icon=con)
        cur_item.data['path'] = 'recent:///'

        cur_item = self.bookmarks_lst.item_append('')
        cur_item.separator_set(True)

        con = Icon(self,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        con.standard_set('user-home')
        con.show()

        cur_item = self.bookmarks_lst.item_append('Home', icon=con)
        cur_item.data['path'] = self.home

        if os.path.isdir(self.desktop):
            con = Icon(self,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)
            con.standard_set('user-desktop')
            con.show()

            cur_item = self.bookmarks_lst.item_append('Desktop', icon=con)
            cur_item.data['path'] = self.desktop

        con = Icon(self,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        con.standard_set('drive-harddisk')
        con.show()

        cur_item = self.bookmarks_lst.item_append('Root', icon=con)
        cur_item.data['path'] = self.root

        cur_item = self.bookmarks_lst.item_append('')
        cur_item.separator_set(True)

        for url in self.get_gtk_bookmarks():
            con = Icon(self,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)
            con.standard_set('folder')
            con.show()
            cur_item = self.bookmarks_lst.item_append(url.split('/')[-1],
                                                      icon=con)
            cur_item.data['path'] = url[7:]
 def content_get(self, gen_lst, part, data):
     '''Return Icon for GenlistItem'''
     icon = None
     if part == 'elm.swallow.icon':
         try:
             icon = Icon(gen_lst, standard='file')
         except RuntimeWarning:
             try:
                 icon = Icon(gen_lst, standard='gtk-file')
             except RuntimeWarning:
                 if not FileGLIC.error:
                     print('ERROR: Cannot find gtk-file icon')
                     FileGLIC.error = True
     return icon
def check_clicked(obj):
    win = StandardWindow("check", "Check test", autodel=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bx)
    bx.show()

    ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
    ck = Check(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ,
        text="Icon sized to check", content=ic, state=True
        )
    ck.callback_changed_add(ck_1)
    bx.pack_end(ck)
    ck.show()
    ic.show()

    ic = Icon(win, file=ic_file, resizable=(0, 0))
    ck = Check(win, text="Icon no scale", content=ic)
    ck.callback_changed_add(ck_2)
    bx.pack_end(ck)
    ck.show()
    ic.show()

    ck = Check(win, text="Label Only")
    ck.callback_changed_add(ck_3)
    bx.pack_end(ck)
    ck.show()

    ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
    ck = Check(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ,
        text="Disabled check", content=ic, state=True
        )
    ck.callback_changed_add(ck_never)
    bx.pack_end(ck)
    ck.disabled_set(True)
    ck.show()
    ic.show()

    ic = Icon(win, file=ic_file,
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1), resizable=(0, 0))
    ck = Check(win, content=ic)
    ck.callback_changed_add(ck_4)
    bx.pack_end(ck)
    ck.show()
    ic.show()

    win.show()
def frame_clicked(obj):
    win = StandardWindow("frame", "Frame test", autodel=True, size=(320, 320))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    vbox = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(vbox)
    vbox.show()

    # frame 1 (label)
    lbl = Label(win, text="content")
    fr = Frame(win,
               size_hint_align=FILL_BOTH,
               text="Frame (label)",
               content=lbl)
    vbox.pack_end(fr)
    fr.show()

    # frame 1 (icon)
    ic = Icon(win,
              file=os.path.join(img_path, "logo_small.png"),
              resizable=(False, False))
    fr = Frame(win, size_hint_align=FILL_BOTH, text="Frame (icon)", content=ic)
    vbox.pack_end(fr)
    fr.show()

    # frame 2 (collapsable label)
    lbl = Label(win, text="content")
    fr = Frame(win,
               size_hint_align=FILL_BOTH,
               autocollapse=True,
               text="Frame (collapsable label)",
               content=lbl)
    vbox.pack_end(fr)
    fr.show()

    # frame 3(collapsable icon)
    ic = Icon(win,
              file=os.path.join(img_path, "logo_small.png"),
              resizable=(False, False))
    fr = Frame(win,
               size_hint_align=FILL_BOTH,
               autocollapse=True,
               text="Frame (collapsable icon)",
               content=ic)
    vbox.pack_end(fr)
    fr.show()

    win.show()
def box_transition_clicked(obj, item=None):
    win = StandardWindow("box-layout-transition",
                         "Box Layout Transition",
                         autodel=True)

    vbox = Box(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(vbox)
    vbox.show()

    bx = Box(win,
             layout=ELM_BOX_LAYOUT_HORIZONTAL,
             size_hint_align=FILL_BOTH,
             size_hint_weight=EXPAND_BOTH)
    vbox.pack_end(bx)
    bx.show()

    sep = Separator(win, horizontal=True)
    vbox.pack_end(sep)
    sep.show()

    bt = Button(win, text="layout: %s" % layout_list[current_layout])
    bt.callback_clicked_add(box_transition_button_cb, bx)
    vbox.pack_end(bt)
    bt.show()

    for i in range(4):
        ic = Icon(win,
                  file=ic_file,
                  resizable=(0, 0),
                  size_hint_align=(0.5, 0.5))
        bx.pack_end(ic)
        ic.show()

    win.show()
def gl_anim_start(anim_st):
    # Start icons animation before actually drag-starts
    yposret = 0

    items = list(anim_st.gl.selected_items)
    gli, yposret = anim_st.gl.at_xy_item_get(anim_st.mdx, anim_st.mdy)
    if gli is not None:
        # Add the item mouse is over to the list if NOT seleced
        if not gli in items:
            items.append(gli)

    for gli in items:
        # Now add icons to animation window
        o = gli.part_content_get("elm.swallow.icon")

        if o is not None:
            st = AnimIconSt()
            ic = Icon(anim_st.gl,
                      file=o.file,
                      size_hint_align=FILL_BOTH,
                      size_hint_weight=EXPAND_BOTH,
                      pos=o.pos,
                      size=o.size)
            st.start_x, st.start_y = o.pos
            ic.show()

            st.o = ic
            anim_st.icons.append(st)

    anim_st.tm = None
    anim_st.ea = AnimatorTimeline(drag_anim_play, DRAG_TIMEOUT, anim_st)

    return ECORE_CALLBACK_CANCEL
Beispiel #11
0
 def __init__(self, rent):
     Box.__init__(self, rent)
     self.parent = rent
     
     #This appears on the button in the main swmai window
     self.name = "Skel"
     #The section in the main window the button is added to
     self.section = "The Body"
     #Search terms that this module should appear for
     self.searchData = []
     #Command line argument to open this module directly
     self.launchArg = "--skel"
     #Should be none by default. This value is used internally by swami
     self.button = None
     
     self.icon = Icon(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
     self.icon.standard_set('icon-name')
     self.icon.show()
     
     self.mainBox = Box(self, size_hint_weight = EXPAND_BOTH)
     self.mainBox.show()
     
     buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
     buttonBox.horizontal = True
     
     buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed)
     buttonReturn.show()
     
     buttonBox.pack_end(buttonReturn)
     buttonBox.show()
     
     self.pack_end(self.mainBox)
     self.pack_end(buttonBox)
def gl_createicon(win, xoff, yoff, data):
    it = data
    o = it.part_content_get("elm.swallow.icon")

    if o is None:
        return

    w = h = 30

    f, g = o.file

    xm, ym = o.evas.pointer_canvas_xy

    if xoff is not None:
        xoff = xm - (w / 2)
    if yoff is not None:
        yoff = ym - (h / 2)

    icon = Icon(win,
                file=(f, g),
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH)

    if (xoff is not None) and (yoff is not None):
        icon.move(xoff, yoff)
    icon.resize(w, h)

    return icon, xoff, yoff
def gl_icons_get(gl):
    # Start icons animation before actually drag-starts

    yposret = 0
    icons = []

    xm, ym = gl.evas.pointer_canvas_xy
    items = list(gl.selected_items)
    gli, yposret = gl.at_xy_item_get(xm, ym)

    if gli is not None:
        # Add the item mouse is over to the list if NOT seleced
        if not gli in items:
            items.append(gli)

    for it in items:
        # Now add icons to animation window
        o = it.part_content_get("elm.swallow.icon")

        if o is not None:
            f, g = o.file
            x, y, w, h = o.geometry

            ic = Icon(gl,
                      file=(f, g),
                      size_hint_align=FILL_BOTH,
                      size_hint_weight=EXPAND_BOTH,
                      pos=(x, y),
                      size=(w, h))

            ic.show()
            icons.append(ic)

    return icons
def grid_icons_get(grid):
    # Start icons animation before actually drag-starts

    xposret, yposret = 0, 0
    icons = []

    xm, ym = grid.evas.pointer_canvas_xy
    items = list(grid.selected_items)
    print(items)
    gli, xposret, yposret = grid.at_xy_item_get(xm, ym)
    if gli is not None:
        # Add the item mouse is over to the list if NOT seleced
        if not gli in items:
            items.append(gli)
    print(items)

    for gli in items:
        # Now add icons to animation window
        o = gli.part_content_get("elm.swallow.icon")

        if o is not None:
            ic = Icon(grid,
                      file=o.file,
                      pos=o.pos,
                      size=o.size,
                      size_hint_align=FILL_BOTH,
                      size_hint_weight=EXPAND_BOTH)
            ic.show()
            icons.append(ic)

    return icons
Beispiel #15
0
    def __init__(self, app):
        # create the main window
        StandardWindow.__init__(self,
                                "eepdater",
                                "eepDater - System Updater",
                                autodel=True,
                                size=(320, 320))
        self.callback_delete_request_add(lambda o: elementary.exit())
        self.app = app

        icon = Icon(self)
        icon.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
        icon.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL)
        icon.standard_set('software-center')
        icon.show()
        self.icon_object_set(icon.object_get())

        # build the two main boxes
        self.mainBox = self.buildMainBox()
        self.loadBox = self.buildLoadBox()

        # build the information details inwin object
        self.buildDetailsWin()

        # the flip object has the load screen on one side and the GUI on the other
        self.flip = Flip(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", self.mainBox)
        self.flip.part_content_set("back", self.loadBox)
        self.resize_object_add(self.flip)
        self.flip.show()

        # show the window
        self.show()
def page4(bt, nf):
    ic = Icon(nf, file=os.path.join(img_path, "icon_right_arrow.png"))
    bt = Button(nf, content=ic)
    bt.callback_clicked_add(page5, nf)

    content = Photo(nf,
                    file=os.path.join(img_path, "rock_02.jpg"),
                    fill_inside=True,
                    style="shadow")

    item = nf.item_push("Page 4", None, bt, content, "basic")
    ic = Icon(nf, file=os.path.join(img_path, "logo_small.png"))
    item.part_content_set("icon", ic)
    item.part_text_set("subtitle", "Title area visibility test")
    item.title_enabled = (False, False)

    content.callback_clicked_add(title_visible, item)
 def content_get(self, obj, part, data, *args):
     if part == "elm.swallow.icon":
         icon = Icon(obj,
                     file=os.path.join(img_path, data),
                     size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
         icon.show()
         return icon
     return None
Beispiel #18
0
 def content_get(self, obj, part, data):
     ic = Icon(obj)
     if part == "elm.swallow.end":
         f = os.path.join(img_path, "bubble.png")
     else:
         f = os.path.join(img_path, "logo_small.png")
     ic.file = f
     ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
     return ic
Beispiel #19
0
 def content_get(self, gg, part, data):
     if not part == "elm.swallow.icon":
         ic = Icon(gg,
                   scale=0.5,
                   file=os.path.join(img_path,
                                     "icon_%02i.png" % (data % 4)),
                   resizable=(0, 0),
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=(0.5, 0.5))
         ic.show()
         return ic
Beispiel #20
0
    def content_get(self, gl, part, data):
        if not part == "elm.swallow.end":
            bt = Button(gl,
                        text="OK",
                        size_hint_align=FILL_BOTH,
                        size_hint_weight=EXPAND_BOTH)
        else:
            bt = Icon(gl,
                      file=os.path.join(img_path, "logo_small.png"),
                      size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))

        return bt
Beispiel #21
0
    def startupAppAdd(self, lst, itm):
        text = itm.text
        dataFile = itm.data["file"]
        dataIcon = itm.data["icon"]
        itm.delete()

        if dataIcon:
            iconObj = Icon(self,
                           standard=dataIcon,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        else:
            iconObj = Icon(self,
                           standard="preferences-system",
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)

        ourItem = self.startupList.item_append(text, iconObj)
        ourItem.data["file"] = dataFile
        ourItem.data["icon"] = dataIcon
        self.startupList.go()
def box_horiz_clicked(obj, item=None):
    win = StandardWindow("box-horiz", "Box Horiz", autodel=True)

    bx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bx)
    bx.show()

    for align in ((0.5, 0.5), (0.5, 0.0), (0.0, EVAS_HINT_EXPAND)):
        ic = Icon(win, file=ic_file, resizable=(0, 0), size_hint_align=align)
        bx.pack_end(ic)
        ic.show()

    win.show()
def page2(bt, nf):
    ic = Icon(nf, file=os.path.join(img_path, "icon_right_arrow.png"))

    bt = Button(nf, content=ic)
    bt.callback_clicked_add(page3, nf)

    content = Photo(nf,
                    file=os.path.join(img_path, "plant_01.jpg"),
                    fill_inside=True,
                    style="shadow")

    item = nf.item_push("Page 2", None, bt, content, "basic")
    item.part_text_set("subtitle", "Here is sub-title part!")
def hover_clicked(obj, item=None):
    win = StandardWindow("hover", "Hover", autodel=True, size=(320, 320))

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bx)
    bx.show()

    hv = Hover(win)

    bt = Button(win, text="Button")
    bt.callback_clicked_add(hover_bt1_clicked, hv)
    bx.pack_end(bt)
    bt.show()
    hv.target = bt

    bt = Button(win, text="Popup")
    hv.part_content_set("middle", bt)
    bt.show()

    bx = Box(win)

    ic = Icon(win,
              file=os.path.join(img_path, "logo_small.png"),
              resizable=(False, False))
    bx.pack_end(ic)
    ic.show()

    for t in "Top 1", "Top 2", "Top 3":
        bt = Button(win, text=t)
        bx.pack_end(bt)
        bt.show()

    bx.show()

    hv.part_content_set("top", bx)

    bt = Button(win, text="Bottom")
    hv.part_content_set("bottom", bt)
    bt.show()

    bt = Button(win, text="Left")
    hv.part_content_set("left", bt)
    bt.show()

    bt = Button(win, text="Right")
    hv.part_content_set("right", bt)
    bt.show()

    win.show()
def page3(bt, nf):
    bt = Button(nf, text="Prev")
    bt.callback_clicked_add(navi_pop, nf)

    bt2 = Button(nf, text="Next")
    bt2.callback_clicked_add(page4, nf)

    content = Photo(nf,
                    file=os.path.join(img_path, "rock_01.jpg"),
                    fill_inside=True,
                    style="shadow")

    item = nf.item_push("Page 3", bt, bt2, content, "basic")

    ic = Icon(nf, file=os.path.join(img_path, "logo_small.png"))
    item.part_content_set("icon", ic)
def icon_transparent_clicked(obj, item=None):
    win = Window("icon-transparent",
                 ELM_WIN_BASIC,
                 title="Icon Transparent",
                 autodel=True,
                 alpha=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    icon = Icon(win,
                file=os.path.join(img_path, "logo.png"),
                resizable=(False, False))
    win.resize_object_add(icon)
    icon.show()

    win.show()
Beispiel #27
0
    def __init__(self, ourParent, ourMsg, ourIcon=None, *args, **kwargs):
        Popup.__init__(self, ourParent, *args, **kwargs)
        self.callback_block_clicked_add(lambda obj: self.delete())

        # Add a table to hold dialog image and text to Popup
        tb = Table(self, size_hint_weight=EXPAND_BOTH)
        self.part_content_set("default", tb)
        tb.show()

        # Add dialog-error Image to table
        need_ethumb()
        icon = Icon(self, thumb='True')
        icon.standard_set(ourIcon)
        # Using gksudo or sudo fails to load Image here
        #   unless options specify using preserving their existing environment.
        #   may also fail to load other icons but does not raise an exception
        #   in that situation.
        # Works fine using eSudo as a gksudo alternative,
        #   other alternatives not tested
        try:
            dialogImage = Image(self,
                                size_hint_weight=EXPAND_HORIZ,
                                size_hint_align=FILL_BOTH,
                                file=icon.file_get())
            tb.pack(dialogImage, 0, 0, 1, 1)
            dialogImage.show()
        except RuntimeError:
            # An error message is displayed for this same error
            #   when aboutWin is initialized so no need to redisplay.
            pass
        # Add dialog text to table
        dialogLabel = Label(self,
                            line_wrap=ELM_WRAP_WORD,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH)
        dialogLabel.text = ourMsg
        tb.pack(dialogLabel, 1, 0, 1, 1)
        dialogLabel.show()

        # Ok Button
        ok_btt = Button(self)
        ok_btt.text = "Ok"
        ok_btt.callback_clicked_add(lambda obj: self.delete())
        ok_btt.show()

        # add button to popup
        self.part_content_set("button3", ok_btt)
Beispiel #28
0
    def addButtonPressed(self, btn):
        toAppend = "file://%s%s"%(self.filepathEntry.text, self.selectedFolder.text.replace(" ", "%20"))

        con = Icon(self, size_hint_weight=EXPAND_BOTH,
                    size_hint_align=FILL_BOTH)
        con.standard_set("gtk-directory")
        con.show()
        it = self.bookmarksList.item_append(self.selectedFolder.text, icon=con)
        it.data["path"] = "%s%s"%(self.filepathEntry.text, self.selectedFolder.text)

        self.bookmarksList.go()

        self.addButton.disabled = True
        self.removeButton.disabled = False

        with open(os.path.expanduser('~/.config/gtk-3.0/bookmarks'),'a') as f:
                f.write( toAppend + " " + self.selectedFolder.text + "\n" )
Beispiel #29
0
    def __init__(self,
                 ourParent,
                 ourText,
                 ourIcon=None,
                 ourCB=None,
                 *args,
                 **kwargs):
        Button.__init__(self, ourParent, *args, **kwargs)
        icon = Icon(self,
                    size_hint_weight=EXPAND_BOTH,
                    size_hint_align=FILL_BOTH)
        icon.standard_set(ourIcon)
        icon.show()

        self.text = ourText
        self.content_set(icon)
        self.callback_clicked_add(ourCB)
def icon_clicked(obj, item=None):
    win = StandardWindow("icon test",
                         "Icon Test",
                         autodel=True,
                         size=(400, 400))
    win.show()

    box = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(box)
    box.show()

    ic = Icon(box,
              file=os.path.join(img_path, "logo.png"),
              resizable=(True, True),
              size_hint_weight=EXPAND_BOTH,
              size_hint_align=FILL_BOTH)
    box.pack_end(ic)
    ic.show()

    hbox = Box(box, horizontal=True, size_hint_weight=EXPAND_HORIZ)
    box.pack_end(hbox)
    hbox.show()

    # Test Aspect Fixed
    tg = Check(hbox, text="Aspect Fixed", state=True)
    tg.callback_changed_add(aspect_fixed_cb, ic)
    hbox.pack_end(tg)
    tg.show()

    # Test Fill Outside
    tg = Check(hbox, text="Fill Outside")
    tg.callback_changed_add(fill_outside_cb, ic)
    hbox.pack_end(tg)
    tg.show()

    # Test Smooth
    tg = Check(hbox, text="Smooth", state=True)
    tg.callback_changed_add(smooth_cb, ic)
    hbox.pack_end(tg)
    tg.show()

    # Test Preload, Prescale
    bt = Button(hbox, text="Preload & Prescale")
    bt.callback_clicked_add(bt_clicked)
    hbox.pack_end(bt)
    bt.show()