def cursor2_clicked(obj, item=None):
    win = StandardWindow("cursors", "Cursors 2", autodel=True, size=(320, 480))

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

    tb = Toolbar(win,
                 size_hint_weight=(0.0, 0.0),
                 size_hint_align=(EVAS_HINT_FILL, 0.0))
    ti = tb.item_append("folder-new", "Bogosity", None, None)
    ti.cursor_set("bogosity")
    ti = tb.item_append("clock", "Unset", None, None)
    ti.cursor_unset()
    ti = tb.item_append("document-print", "Xterm", None, None)
    ti.cursor_set("xterm")
    bx.pack_end(tb)
    tb.show()

    lst = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    li = lst.item_append("cursor bogosity")
    li.cursor_set("bogosity")
    li = lst.item_append("cursor unset")
    li.cursor_unset()
    li = lst.item_append("cursor xterm")
    li.cursor_set("xterm")
    bx.pack_end(lst)
    lst.go()
    lst.show()

    win.show()
Beispiel #2
0
    def __init__(self, doc_specs={}):
        SCALE = elm_conf.scale

        self.docs = []
        self.doc_specs = doc_specs

        self.settings = {"scroll_by_page": False}

        super(AppWindow, self).__init__("main",
                                        "Lekha",
                                        size=(400 * SCALE, 400 * SCALE),
                                        autodel=True)

        main_box = self.main_box = Box(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(main_box)

        tb = self.tb = Toolbar(
            self,  # For some reason item menus break when parent is main_box
            size_hint_weight=EXPAND_HORIZ,
            size_hint_align=FILL_HORIZ,
            select_mode=ELM_OBJECT_SELECT_MODE_NONE,
            icon_size=24)
        tb.item_append("document-open", "Open",
                       lambda x, y: Fs(self.document_open))
        tb.item_append("view-fullscreen", "Fullscreen",
                       lambda x, y: self.fullscreen_set(True))
        it = tb.item_append("preferences-system", "Settings",
                            self._settings_open)

        tabs = self.tabs = Tabs(main_box,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)

        # tabs.callback_add(
        #     "tab,added", lambda x, y: self.title_set(y.doc_title))
        tabs.callback_add("tab,selected",
                          lambda x, y: self.title_set(y.doc_title))

        def selected_cb(tabs, content):
            for c in content.page_box:
                c.changed()

        tabs.callback_add("tab,selected", selected_cb)
        tabs.callback_add("tab,deleted", lambda x, y: y.delete())

        main_box.pack_end(tb)
        main_box.pack_end(tabs)
        tb.show()
        tabs.show()

        self.callback_fullscreen_add(self._fullscreen_cb)
        self.callback_unfullscreen_add(self._unfullscreen_cb)
        self.elm_event_callback_add(self._event_handler)

        main_box.show()
Beispiel #3
0
    def buildMainBox(self):
        # build our toolbar
        self.mainTb = Toolbar(self,
                              homogeneous=False,
                              size_hint_weight=(0.0, 0.0),
                              size_hint_align=(EVAS_HINT_FILL, 0.0))
        self.mainTb.item_append("remove", "Clear", self.clearPressed)
        self.mainTb.item_append("system-run", "Select All",
                                self.selectAllPressed)
        self.mainTb.item_append("view-refresh", "Refresh", self.refreshPressed)
        self.mainTb.item_append("info", "Log", self.detailsPressed)
        self.mainTb.item_append("ok", "Apply", self.installUpdatesPressed)
        self.mainTb.show()

        # build our sortable list that displays packages that need updates
        titles = [("Upgrade", True), ("Package", True), ("Installed", True),
                  ("Available", True)]
        scr = Scroller(self,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)
        self.packageList = sl.SortedList(scr,
                                         titles=titles,
                                         homogeneous=False,
                                         size_hint_weight=EXPAND_HORIZ)
        scr.content = self.packageList
        scr.show()

        # build the label that shows the package's description
        self.currentDescription = Label(self, size_hint_weight=FILL_BOTH)
        self.currentDescription.text = "Select a package for information"
        self.currentDescription.line_wrap_set(True)
        self.currentDescription.show()

        self.desFrame = Frame(self,
                              size_hint_weight=EXPAND_HORIZ,
                              size_hint_align=FILL_HORIZ)
        self.desFrame.text = "Description"
        self.desFrame.content = self.currentDescription
        self.desFrame.show()

        # add all of our objects to the box
        box = Box(self,
                  size_hint_weight=EXPAND_BOTH,
                  size_hint_align=FILL_BOTH)
        box.pack_end(self.mainTb)
        box.pack_end(scr)
        box.pack_end(self.desFrame)
        box.show()

        return box
Beispiel #4
0
def tooltip_clicked(obj):
    win = StandardWindow("tooltips", "Tooltips", autodel=True, size=(400, 500))
    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()

    tb = Toolbar(win,
                 homogeneous=False,
                 size_hint_weight=EXPAND_HORIZ,
                 size_hint_align=FILL_HORIZ)
    bx.pack_end(tb)
    tb.show()

    ti = tb.item_append("folder-new", "Open", None, None)
    ti.tooltip_text_set("Opens a file")

    ti = tb.item_append("clock", "Icon", None, None)
    ti.tooltip_content_cb_set(_tt_item_icon, None)
    ti.tooltip_style_set("transparent")

    bt = Button(win, text="Simple text tooltip")
    bt.tooltip_text_set("Simple text tooltip")
    bx.pack_end(bt)
    bt.show()

    def _tt_text_replace(obj, data):
        value = data.get("value")
        if not value:
            value = 1
        obj.tooltip_text_set("count=%d" % value)
        value += 1
        data["value"] = value

    bt = Button(win, text="Simple text tooltip, click to change")
    bt.tooltip_text_set("Initial")
    data = dict()
    bt.callback_clicked_add(_tt_text_replace, data)
    bx.pack_end(bt)
    bt.show()

    def _tt_text_replace_timer_cb(obj, data):
        _tt_text_replace(obj, data)
        return True

    def _tt_text_replace_timed(obj, data, *args, **kargs):
        timer = data.get("timer")
        if timer:
            timer.delete()
            del data["timer"]
            obj.text_set("Simple text tooltip, click to start changed timed")
            return
        data["timer"] = Timer(1.5, _tt_text_replace_timer_cb, obj, data)
        obj.text_set("Simple text tooltip, click to stop changed timed")

    bt = Button(win, text="Simple text tooltip, click to start changed timed")
    bt.tooltip_text_set("Initial")
    data = dict()
    bt.callback_clicked_add(_tt_text_replace_timed, data)
    bx.pack_end(bt)
    bt.show()
    bt.on_del_add(_tt_timer_del, data)

    bt = Button(win, text="Icon tooltip")
    bt.tooltip_content_cb_set(_tt_icon, None)
    bx.pack_end(bt)
    bt.show()

    def _tt_icon_replace_timer_cb(obj, data):
        value = data.get("value")
        data["value"] = not value
        if value:
            obj.tooltip_content_cb_set(_tt_icon)
        else:
            obj.tooltip_content_cb_set(_tt_icon2)
        return True

    def _tt_icon_replace_timed(obj, data, *args, **kargs):
        timer = data.get("timer")
        if timer:
            timer.delete()
            del data["timer"]
            obj.text_set("Icon tooltip, click to start changed timed")
            return
        data["timer"] = timer_add(1.5, _tt_icon_replace_timer_cb, obj, data)
        obj.text_set("Icon tooltip, click to stop changed timed")

    bt = Button(win, text="Icon tooltip, click to start changed timed")
    bt.tooltip_content_cb_set(_tt_icon)
    data = dict()
    bt.callback_clicked_add(_tt_icon_replace_timed, data)
    bx.pack_end(bt)
    bt.show()
    bt.on_del_add(_tt_timer_del, data)

    bt = Button(win, text="Transparent Icon tooltip")
    bt.tooltip_content_cb_set(_tt_icon, None)
    bt.tooltip_style_set("transparent")
    bx.pack_end(bt)
    bt.show()

    def _tt_style_replace_timer_cb(obj, data):
        value = data.get("value")
        data["value"] = not value
        if value:
            obj.tooltip_style_set()
        else:
            obj.tooltip_style_set("transparent")
        return True

    def _tt_style_replace_timed(obj, data, *args, **kargs):
        timer = data.get("timer")
        if timer:
            timer.delete()
            del data["timer"]
            obj.text_set("Icon tooltip style, click to start changed timed")
            return
        data["timer"] = timer_add(1.5, _tt_style_replace_timer_cb, obj, data)
        obj.text_set("Icon tooltip, click to stop changed timed")

    bt = Button(win, text="Icon tooltip style, click to start changed timed")
    bt.tooltip_content_cb_set(_tt_icon, None)
    data = dict()
    bt.callback_clicked_add(_tt_style_replace_timed, data)
    bx.pack_end(bt)
    bt.show()
    bt.on_del_add(_tt_timer_del, data)

    def _tt_visible_lock_toggle(obj, data, *args, **kargs):
        value = data.get("value")
        data["value"] = not value
        if value:
            obj.text_set("Unlocked tooltip visibility")
            obj.tooltip_hide()
        else:
            obj.text_set("Locked tooltip visibility")
            obj.tooltip_show()

    bt = Button(win, text="Unlocked tooltip visibility")
    bt.tooltip_text_set(
        "This tooltip is unlocked visible,<br> click the button to lock!")
    data = dict()
    bt.callback_clicked_add(_tt_visible_lock_toggle, data)
    bx.pack_end(bt)
    bt.show()

    def _tt_move_freeze_toggle(obj, *args, **kargs):
        if obj.tooltip_move_freeze_get():
            obj.text_set("Unfreezed tooltip movement")
            obj.tooltip_move_freeze_pop()
        else:
            obj.text_set("Freezed tooltip movement")
            obj.tooltip_move_freeze_push()

    bt = Button(win, text="Freezed tooltip movement")
    bt.tooltip_text_set(
        "This tooltip has freezed movement,<br> click the button to unfreeze!")
    bt.tooltip_move_freeze_push()
    bt.callback_clicked_add(_tt_move_freeze_toggle)
    bx.pack_end(bt)
    bt.show()

    en = Entry(win,
               scrollable=True,
               single_line=True,
               entry="Hello, some scrolled entry here!",
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_HORIZ)
    en.tooltip_text_set("Type something here!")
    bx.pack_end(en)
    en.show()

    lst = List(win,
               size_hint_weight=EXPAND_BOTH,
               size_hint_align=FILL_BOTH,
               size_hint_min=(100, 100))
    li = lst.item_append("Hello")
    li.tooltip_text_set("Something useful here?")
    li = lst.item_append("Icon Tooltip")
    li.tooltip_content_cb_set(_tt_item_icon, None)
    bx.pack_end(lst)
    lst.go()
    lst.show()

    win.show()
Beispiel #5
0
    def __init__(self, parent, session):
        self.parent = parent
        self.session = session

        elm_conf = Configuration()
        scale = elm_conf.scale

        self.log = logging.getLogger("epour.gui")

        self.torrentitems = {}

        win = self.win = StandardWindow("epour", "Epour")
        win.callback_delete_request_add(lambda x: elm.exit())
        win.screen_constrain = True
        win.size = 480 * scale, 400 * scale

        mbox = Box(win)
        mbox.size_hint_weight = 1.0, 1.0
        win.resize_object_add(mbox)
        mbox.show()

        tb = Toolbar(win)
        tb.homogeneous = False
        tb.shrink_mode = ELM_TOOLBAR_SHRINK_NONE
        tb.select_mode = ELM_OBJECT_SELECT_MODE_NONE
        tb.size_hint_align = -1.0, 0.0
        tb.menu_parent = win

        item = tb.item_append("document-new", "Add torrent",
                              lambda t, i: self.select_torrent())

        def pause_session(it):
            self.session.pause()
            it.state_set(it.state_next())

        def resume_session(it):
            session.resume()
            del it.state

        item = tb.item_append("media-playback-pause", "Pause Session",
                              lambda tb, it: pause_session(it))
        item.state_add("media-playback-start", "Resume Session",
                       lambda tb, it: resume_session(it))

        item = tb.item_append("preferences-system", "Preferences")
        item.menu = True
        item.menu.item_add(None, "General", "preferences-system",
                           lambda o, i: PreferencesGeneral(self, self.session))
        item.menu.item_add(None, "Proxy", "preferences-system",
                           lambda o, i: PreferencesProxy(self, self.session))
        item.menu.item_add(None, "Session", "preferences-system",
                           lambda o, i: PreferencesSession(self, self.session))

        item = tb.item_append("application-exit", "Exit",
                              lambda tb, it: elm.exit())

        mbox.pack_start(tb)
        tb.show()

        self.tlist = tlist = Genlist(win)
        tlist.select_mode = ELM_OBJECT_SELECT_MODE_NONE
        tlist.mode = ELM_LIST_COMPRESS
        tlist.callback_activated_add(self.item_activated_cb)
        tlist.homogeneous = True
        tlist.size_hint_weight = 1.0, 1.0
        tlist.size_hint_align = -1.0, -1.0
        tlist.show()

        mbox.pack_end(tlist)

        pad = Rectangle(win.evas)
        pad.size_hint_weight = 1.0, 1.0

        p = Panel(win)
        p.color = 200, 200, 200, 200
        p.size_hint_weight = 1.0, 1.0
        p.size_hint_align = -1.0, -1.0
        p.orient = ELM_PANEL_ORIENT_BOTTOM
        p.content = SessionStatus(win, session)
        p.hidden = True
        p.show()

        topbox = Box(win)
        topbox.horizontal = True
        topbox.size_hint_weight = 1.0, 1.0
        win.resize_object_add(topbox)

        topbox.pack_end(pad)
        topbox.pack_end(p)
        topbox.stack_above(mbox)
        topbox.show()

        session.alert_manager.callback_add("torrent_added_alert",
                                           self.torrent_added_cb)
        session.alert_manager.callback_add("torrent_removed_alert",
                                           self.torrent_removed_cb)

        for a_name in "torrent_paused_alert", "torrent_resumed_alert":
            session.alert_manager.callback_add(a_name, self.update_icon)

        session.alert_manager.callback_add("state_changed_alert",
                                           self.state_changed_cb)

        Timer(
            15.0, lambda: session.alert_manager.callback_add(
                "torrent_finished_alert", self.torrent_finished_cb))
def toolbar_clicked(obj, item=None):
    win = StandardWindow("toolbar", "Toolbar", autodel=True, size=(320, 300))
    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()

    tbl = Table(win,
                size_hint_weight=(0.0, EVAS_HINT_EXPAND),
                size_hint_align=FILL_BOTH)

    tb = Toolbar(win,
                 homogeneous=False,
                 size_hint_weight=(0.0, 0.0),
                 size_hint_align=(EVAS_HINT_FILL, 0.0))

    ph1 = Photo(win,
                size=40,
                file=os.path.join(img_path, "plant_01.jpg"),
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=ALIGN_CENTER)
    tbl.pack(ph1, 0, 0, 1, 1)
    ph1.show()

    ph2 = Photo(win,
                size=80,
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=ALIGN_CENTER)
    tbl.pack(ph2, 1, 0, 1, 1)
    ph2.show()

    ph3 = Photo(win,
                size=40,
                file=os.path.join(img_path, "sky_01.jpg"),
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=ALIGN_CENTER)
    tbl.pack(ph3, 0, 1, 1, 1)
    ph3.show()

    ph4 = Photo(win,
                size=60,
                file=os.path.join(img_path, "sky_02.jpg"),
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=ALIGN_CENTER)
    tbl.pack(ph4, 1, 1, 1, 1)
    ph4.show()

    item = tb.item_append("document-print", "Hello", tb_1)
    item.disabled = True

    item = tb.item_append("clock", "World,", tb_2, ph2)
    item.selected = True

    tb.item_append("folder-new", "here", tb_3, ph4)
    tb.item_append("clock", "comes", tb_4, ph4)
    tb.item_append("folder-new", "python-elementary!", tb_5, ph4)

    item = tb.item_append("clock", "Menu", tb_5, ph4)
    item.menu = True
    tb.menu_parent = win

    menu = item.menu

    menu.item_add(None, "Here", "clock", tb_3, ph4)
    menu_item = menu.item_add(None, "Comes", "refresh", tb_4, ph4)
    menu.item_add(menu_item, "hey ho", "folder-new", tb_4, ph4)
    menu.item_add(None, "python-elementary", "document-print", tb_5, ph4)

    bx.pack_end(tb)
    tb.show()

    bx.pack_end(tbl)
    tbl.show()

    win.show()
def toolbar5_clicked(obj, item=None):
    win = StandardWindow("toolbar5",
                         "Toolbar 5",
                         autodel=True,
                         size=(320, 300))
    win.autodel = True

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

    tbl = Table(win,
                size_hint_weight=(0.0, EVAS_HINT_EXPAND),
                size_hint_align=FILL_BOTH)

    tb = Toolbar(win,
                 homogeneous=False,
                 shrink_mode=ELM_TOOLBAR_SHRINK_MENU,
                 size_hint_weight=(0.0, 0.0),
                 size_hint_align=(EVAS_HINT_FILL, 0.0),
                 select_mode=ELM_OBJECT_SELECT_MODE_NONE)

    ph1 = Photo(win,
                size=40,
                file=os.path.join(img_path, "plant_01.jpg"),
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=ALIGN_CENTER)
    tbl.pack(ph1, 0, 0, 1, 1)
    ph1.show()

    ph2 = Photo(win,
                size=80,
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=ALIGN_CENTER)
    tbl.pack(ph2, 1, 0, 1, 1)
    ph2.show()

    ph3 = Photo(win,
                size=20,
                file=os.path.join(img_path, "sky_01.jpg"),
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=ALIGN_CENTER)
    tbl.pack(ph3, 0, 1, 1, 1)
    ph3.show()

    ph4 = Photo(win,
                size=60,
                file=os.path.join(img_path, "sky_02.jpg"),
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=ALIGN_CENTER)
    tbl.pack(ph4, 1, 1, 1, 1)
    ph4.show()

    tb_it = tb.item_append("document-print", "Hello", tb_1, ph1)
    tb_it.disabled = True
    tb_it.priority = 100

    tb_it = tb.item_append(os.path.join(img_path, "icon_04.png"), "World",
                           tb_2, ph1)
    tb_it.priority = -100

    tb_it = tb.item_append("object-rotate-right", "H", tb_3a, ph4)
    tb_it.state_add("object-rotate-left", "H2", tb_3b, ph4)
    tb_it.priority = 150

    tb_it = tb.item_append("mail-send", "Comes", tb_4a, ph4)
    tb_it.state_add("emptytrash", "Comes2", tb_4a, ph4)
    tb_it.state_add("trashcan_full", "Comes3", tb_4a, ph4)
    tb_it.priority = 0

    tb_it = tb.item_append("clock", "Elementary", tb_5, ph4)
    tb_it.priority = -200

    tb_it = tb.item_append("refresh", "Menu")
    tb_it.menu = True
    tb_it.priority = -9999
    tb.menu_parent = win
    menu = tb_it.menu

    menu.item_add(None, "edit-cut", "Shrink", tb_3, ph4)
    menu_it = menu.item_add(None, "edit-copy", "Mode", tb_4, ph4)
    menu.item_add(menu_it, "edit-paste", "is set to", tb_4, ph4)
    menu.item_add(None, "edit-delete", "Menu", tb_5, ph4)

    bx.pack_end(tb)
    tb.show()

    bx.pack_end(tbl)
    tbl.show()

    win.show()
Beispiel #8
0
    def __init__(self):
        self.mainWindow = StandardWindow("epad",
                                         "Untitled - ePad",
                                         size=(600, 400))
        self.mainWindow.callback_delete_request_add(self.closeChecks)
        self.mainWindow.elm_event_callback_add(self.eventsCb)

        icon = Icon(self.mainWindow)
        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(
            'accessories-text-editor'
        )  # assumes image icon is in local dir, may need to change later
        icon.show()
        self.mainWindow.icon_object_set(icon.object_get())

        self.mainBox = Box(self.mainWindow,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.mainBox.show()

        self.mainTb = Toolbar(self.mainWindow,
                              homogeneous=False,
                              size_hint_weight=(0.0, 0.0),
                              size_hint_align=(EVAS_HINT_FILL, 0.0))
        self.mainTb.menu_parent = self.mainWindow

        self.mainTb.item_append("document-new", "New", self.newPress)
        self.mainTb.item_append("document-open", "Open", self.openPress)
        self.mainTb.item_append("document-save", "Save", self.savePress)
        self.mainTb.item_append("document-save-as", "Save As",
                                self.saveAsPress)
        # -- Edit Dropdown Menu --
        tb_it = self.mainTb.item_append("edit", "Edit")
        tb_it.menu = True
        menu = tb_it.menu
        menu.item_add(None, "Copy", "edit-copy", self.copyPress)
        menu.item_add(None, "Paste", "edit-paste", self.pastePress)
        menu.item_add(None, "Cut", "edit-cut", self.cutPress)
        menu.item_separator_add()
        menu.item_add(None, "Select All", "edit-select-all",
                      self.selectAllPress)
        # -----------------------
        # self.mainTb.item_append("settings", "Options", self.optionsPress)
        self.mainTb.item_append("dialog-information", "About", self.aboutPress)

        self.mainEn = Entry(self.mainWindow,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.mainEn.callback_changed_user_add(self.textEdited)
        self.mainEn.scrollable_set(
            True)  # creates scrollbars rather than enlarge window
        self.mainEn.line_wrap_set(
            False)  # does not allow line wrap (can be changed by user)
        self.mainEn.autosave_set(False)  # set to false to reduce disk I/O
        self.mainEn.elm_event_callback_add(self.eventsCb)
        self.mainEn.markup_filter_append(self.textFilter)
        self.mainEn.show()

        self.mainTb.show()

        self.mainBox.pack_end(self.mainTb)
        self.mainBox.pack_end(self.mainEn)

        #Build our file selector for saving/loading files
        self.fileBox = Box(self.mainWindow,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.fileBox.show()

        self.fileLabel = Label(self.mainWindow,
                               size_hint_weight=EXPAND_HORIZ,
                               size_hint_align=FILL_BOTH)
        self.fileLabel.text = ""
        self.fileLabel.show()

        self.fileSelector = Fileselector(self.mainWindow,
                                         is_save=False,
                                         expandable=False,
                                         folder_only=False,
                                         path=os.getenv("HOME"),
                                         size_hint_weight=EXPAND_BOTH,
                                         size_hint_align=FILL_BOTH)
        self.fileSelector.callback_done_add(self.fileSelected)
        #self.fileSelector.callback_selected_add(fs_cb_selected, win)
        #self.fileSelector.callback_directory_open_add(fs_cb_directory_open, win)
        self.fileSelector.show()

        self.fileBox.pack_end(self.fileLabel)
        self.fileBox.pack_end(self.fileSelector)

        # the flip object has the file selector on one side and the GUI on the other
        self.flip = Flip(self.mainWindow,
                         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.fileBox)
        self.mainWindow.resize_object_add(self.flip)
        self.flip.show()

        self.isSaved = True
        self.isNewFile = False
        self.confirmPopup = None
Beispiel #9
0
def focus_clicked(obj, item=None):
    win = StandardWindow("focus", "Focus", autodel=True, size=(800, 600))

    win.focus_highlight_enabled = True

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

    ### Toolbar
    tbar = Toolbar(win,
                   shrink_mode=ELM_TOOLBAR_SHRINK_MENU,
                   size_hint_align=(EVAS_HINT_FILL, 0.0))

    tb_it = tbar.item_append("document-print", "Hello", _tb_sel)
    tb_it.disabled = True
    tb_it = tbar.item_append("folder-new", "World", _tb_sel)
    tb_it = tbar.item_append("object-rotate-right", "H", _tb_sel)
    tb_it = tbar.item_append("mail-send", "Comes", _tb_sel)
    tb_it = tbar.item_append("clock", "Elementary", _tb_sel)

    tb_it = tbar.item_append("refresh", "Menu", _tb_sel)
    tb_it.menu = True
    tbar.menu_parent = win
    menu = tb_it.menu

    menu.item_add(None, "Shrink", "edit-cut", _tb_sel)
    menu_it = menu.item_add(None, "Mode", "edit-copy", _tb_sel)
    menu.item_add(menu_it, "is set to", "edit-paste", _tb_sel)
    menu.item_add(menu_it, "or to", "edit-paste", _tb_sel)
    menu.item_add(None, "Menu", "edit-delete", _tb_sel)

    tbx.pack_end(tbar)
    tbar.show()

    mainbx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
    tbx.pack_end(mainbx)
    mainbx.show()

    ## First Col
    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    mainbx.pack_end(bx)
    bx.show()

    lb = Label(win,
               text="<b>Use Tab or Shift+Tab<br/>or Arrow keys</b>",
               size_hint_align=FILL_BOTH)
    bx.pack_end(lb)
    lb.show()

    tg = Check(win, style="toggle")
    tg.part_text_set("on", "Yes")
    tg.part_text_set("off", "No")
    bx.pack_end(tg)
    tg.show()

    en = Entry(win,
               scrollable=True,
               single_line=True,
               text="This is a single line",
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_HORIZ)
    bx.pack_end(en)
    en.show()

    #
    bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    bx.pack_end(bx2)
    bx2.show()

    for i in range(2):
        bt = Button(win,
                    text="Box",
                    size_hint_align=FILL_BOTH,
                    disabled=(i % 2))
        bx2.pack_end(bt)
        bt.show()

    sc = Scroller(win,
                  bounce=(True, True),
                  content_min_limit=(1, 1),
                  size_hint_weight=EXPAND_BOTH,
                  size_hint_align=FILL_BOTH)
    bx2.pack_end(sc)
    sc.show()

    bt = Button(win, text="Scroller", size_hint_align=FILL_BOTH)
    sc.content = bt
    bt.show()

    #
    bt = Button(win, text="Box", size_hint_align=FILL_BOTH)
    bx.pack_end(bt)
    bt.show()

    #
    bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    bx.pack_end(bx2)
    bx2.show()

    for i in range(2):
        bx3 = Box(win, size_hint_align=FILL_BOTH)
        bx2.pack_end(bx3)
        bx3.show()

        for j in range(3):
            bt = Button(win, text="Box", size_hint_align=FILL_BOTH)
            bx3.pack_end(bt)
            bt.show()

    sc = Scroller(win,
                  bounce=(False, True),
                  content_min_limit=(1, 0),
                  size_hint_align=FILL_BOTH,
                  size_hint_weight=EXPAND_BOTH)
    sc.content_min_limit = (1, 1)
    bx2.pack_end(sc)
    sc.show()

    bx3 = Box(win, size_hint_align=FILL_BOTH)
    sc.content = bx3
    bx3.show()

    for i in range(5):
        bt = Button(win, text="BX Scroller", size_hint_align=FILL_BOTH)
        bx3.pack_end(bt)
        bt.show()

    ## Second Col
    ly = Layout(win, size_hint_weight=EXPAND_BOTH)
    ly.file = edj_file, "twolines"
    mainbx.pack_end(ly)
    ly.show()

    bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    ly.part_content_set("element1", bx2)
    bx2.show()

    for i in range(3):
        bt = Button(win, text="Layout", size_hint_align=FILL_BOTH)
        bx2.pack_end(bt)
        bt.show()
        bx2.focus_custom_chain_prepend(bt)

    bx2 = Box(win, size_hint_align=FILL_BOTH)
    ly.part_content_set("element2", bx2)
    bx2.show()

    bt = Button(win, text="Disable", size_hint_align=FILL_BOTH)
    bt.callback_clicked_add(lambda b: b.disabled_set(True))
    bx2.pack_end(bt)
    bt.show()
    bx2.focus_custom_chain_prepend(bt)

    bt2 = Button(win, text="Enable", size_hint_align=FILL_BOTH)
    bt2.callback_clicked_add(lambda b, b1: b1.disabled_set(False), bt)
    bx2.pack_end(bt2)
    bt2.show()
    bx2.focus_custom_chain_append(bt2)

    ## Third Col
    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    mainbx.pack_end(bx)
    bx.show()

    fr = Frame(
        win,
        text="Frame",
    )
    bx.pack_end(fr)
    fr.show()

    tb = Table(win, size_hint_weight=EXPAND_BOTH)
    fr.content = tb
    tb.show()

    for j in range(1):
        for i in range(2):
            bt = Button(win,
                        text="Table",
                        size_hint_align=FILL_BOTH,
                        size_hint_weight=EXPAND_BOTH)
            tb.pack(bt, i, j, 1, 1)
            bt.show()

    #
    fr = Bubble(win,
                text="Bubble",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_BOTH)
    bx.pack_end(fr)
    fr.show()

    tb = Table(win, size_hint_weight=EXPAND_BOTH)
    fr.content = tb
    tb.show()

    for j in range(2):
        for i in range(1):
            bt = Button(win,
                        text="Table",
                        size_hint_align=FILL_BOTH,
                        size_hint_weight=EXPAND_BOTH)
            tb.pack(bt, i, j, 1, 1)
            bt.show()

    win.show()