Пример #1
0
Файл: gui.py Проект: lonid/epack
    def __init__(self, parent):
        DialogWindow.__init__(self, parent, 'epack-info', 'Epack', autodel=True)

        fr = Frame(self, style='pad_large', size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        self.resize_object_add(fr)
        fr.show()

        hbox = Box(self, horizontal=True, padding=(12,12))
        fr.content = hbox
        hbox.show()

        vbox = Box(self, align=(0.0,0.0), padding=(6,6),
                   size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT)
        hbox.pack_end(vbox)
        vbox.show()

        # icon + version
        ic = Icon(self, standard='epack', size_hint_min=(64,64))
        vbox.pack_end(ic)
        ic.show()

        lb = Label(self, text=_('Version: %s') % __version__)
        vbox.pack_end(lb)
        lb.show()

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

        # buttons
        bt = Button(self, text=_('Epack'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(utils.INFO))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=_('Website'),size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: utils.xdg_open(utils.GITHUB))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=_('Authors'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(utils.AUTHORS))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=_('License'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(utils.LICENSE))
        vbox.pack_end(bt)
        bt.show()

        # main text
        self.entry = Entry(self, editable=False, scrollable=True, text=utils.INFO,
                        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.entry.callback_anchor_clicked_add(lambda e,i: utils.xdg_open(i.name))
        hbox.pack_end(self.entry)
        self.entry.show()

        self.resize(400, 200)
        self.show()
    def __init__(self, parent, label_text, values, initial_value):
        Box.__init__(self, parent)

        self.vd = {
            ELM_ACTIONSLIDER_LEFT: values[0],
            ELM_ACTIONSLIDER_CENTER: values[1],
            ELM_ACTIONSLIDER_RIGHT: values[2],
        }

        self.horizontal = True
        self.size_hint_align = -1.0, 0.0
        self.size_hint_weight = 1.0, 0.0

        l = Label(parent)
        l.text = label_text
        l.show()
        w = self.w = Actionslider(parent)
        w.magnet_pos = ELM_ACTIONSLIDER_ALL
        w.size_hint_align = -1.0, 0.0
        w.size_hint_weight = 1.0, 0.0
        w.show()

        parts = "left", "center", "right"

        for i, v in enumerate(values):
            w.part_text_set(parts[i], str(v))
        w.indicator_pos = values.index(initial_value) + 1

        self.pack_end(l)
        self.pack_end(w)
Пример #3
0
    def build_prog_popup(self):
        pp = Popup(self)
        pp.part_text_set('title,text', _('Extracting files, please wait...'))
        pp.show()

        vbox = Box(self)
        pp.part_content_set('default', vbox)
        vbox.show()

        lb = Label(self,
                   ellipsis=True,
                   size_hint_weight=EXPAND_HORIZ,
                   size_hint_align=FILL_HORIZ)
        vbox.pack_end(lb)
        lb.show()

        pb = Progressbar(pp,
                         size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=FILL_HORIZ)
        vbox.pack_end(pb)
        pb.show()

        bt = Button(pp, text=_('Cancel'))
        bt.callback_clicked_add(lambda b: self.app.abort_operation())
        pp.part_content_set('button1', bt)

        self.prog_pbar = pb
        self.prog_label = lb
        self.prog_popup = pp
def LOG(win, m):
    lb = Label(win,
               text=m,
               size_hint_weight=(0.0, 0.0),
               size_hint_align=FILL_BOTH)
    lb.show()
    return lb
Пример #5
0
Файл: gui.py Проект: lonid/epack
    def build_prog_popup(self):
        pp = Popup(self)
        pp.part_text_set('title,text', _('Extracting files, please wait...'))
        pp.show()

        vbox = Box(self)
        pp.part_content_set('default', vbox)
        vbox.show()

        lb = Label(self, ellipsis=True, size_hint_weight=EXPAND_HORIZ,
                   size_hint_align=FILL_HORIZ)
        vbox.pack_end(lb)
        lb.show()

        pb = Progressbar(pp, size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=FILL_HORIZ)
        vbox.pack_end(pb)
        pb.show()

        bt = Button(pp, text=_('Cancel'))
        bt.callback_clicked_add(lambda b: self.app.abort_operation())
        pp.part_content_set('button1', bt)

        self.prog_pbar = pb
        self.prog_label = lb
        self.prog_popup = pp
Пример #6
0
 def __init__(self, canvas, text):
     n = Notify(canvas)
     l = Label(canvas)
     l.text = text
     n.content = l
     n.timeout = 3
     n.show()
    def __init__(self, parent, session):
        Frame.__init__(self, parent)

        self.text = "Limits"
        self.size_hint_align = FILL_HORIZ

        base = 1024
        units = ( "bytes/s", "KiB/s", "MiB/s", "GiB/s", "TiB/s" )

        t = Table(parent)
        for r, values in enumerate((
            ("Upload limit", session.upload_rate_limit, session.set_upload_rate_limit),
            ("Download limit", session.download_rate_limit, session.set_download_rate_limit),
            ("Upload limit for local connections", session.local_upload_rate_limit, session.set_local_upload_rate_limit),
            ("Download limit for local connections", session.local_download_rate_limit, session.set_local_download_rate_limit),
        )):
            title, rfunc, wfunc = values

            l = Label(parent)
            l.text = title
            l.size_hint_align = FILL_HORIZ
            t.pack(l, 0, r, 1, 1)
            l.show()

            usw = UnitSpinner(parent, base, units)
            usw.size_hint_weight = EXPAND_HORIZ
            usw.size_hint_align = FILL_HORIZ
            usw.set_value(rfunc())
            usw.callback_changed_add(wfunc, delay=2.0)
            t.pack(usw, 1, r, 1, 1)
            usw.show()

        self.content = t
Пример #8
0
    def __init__(self, parent):
        InnerWindow.__init__(self, parent)

        vbox = Box(self)
        vbox.show()
        self.content = vbox

        title = Label(self, scale=2.0, text='Edone %s' % VERSION)
        title.show()
        vbox.pack_end(title)

        en = Entry(self, text=INFO, editable=False, scrollable=True,
                   size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        en.show()
        vbox.pack_end(en)

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

        close = Button(self, text='Close')
        close.callback_clicked_add(lambda b: self.delete())
        close.show()
        vbox.pack_end(close)

        self.activate()
Пример #9
0
Файл: gui.py Проект: lonid/epack
    def __init__(self, parent, title, done_cb, **kargs):
        self._user_cb = done_cb

        self._inwin = InnerWindow(parent)

        vbox = Box(self._inwin)
        self._inwin.content = vbox
        vbox.show()

        lb = Label(vbox, text='<b>%s</b>' % title)
        vbox.pack_end(lb)
        lb.show()

        Fileselector.__init__(self, vbox, expandable=False,
                              size_hint_weight=EXPAND_BOTH,
                              size_hint_align=FILL_BOTH, **kargs)
        self.callback_done_add(self._fileselector_done_cb)
        self.callback_activated_add(self._fileselector_done_cb)
        # TODO this filter seems not to work well...need fixing
        # fs.mime_types_filter_append(list(EXTRACT_MAP.keys()), 'Archive files')
        # fs.mime_types_filter_append(['*'], 'All files')
        vbox.pack_end(self)
        self.show()

        self._inwin.activate()
Пример #10
0
    def buildLoadBox(self):
        # build the load label
        loadLable = Label(self, size_hint_weight=EXPAND_BOTH,
                          size_hint_align=FILL_HORIZ)
        loadLable.text = "<b>Processing</b>"
        loadLable.show()
        
        # build the spinning wheel
        wheel = Progressbar(self, pulse_mode=True,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_HORIZ)
        wheel.pulse(True)
        wheel.show()

        detailsbtn = Button(self, style="anchor")
        detailsbtn.text_set("Details")
        detailsbtn.callback_pressed_add(self.innerWinShow)
        detailsbtn.show()

        # build the status label
        self.statusLabel = Label(self, size_hint_weight=EXPAND_BOTH,
                                 size_hint_align=FILL_HORIZ)
        self.statusLabel.show()

        # put all the built objects in a vertical box
        box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        box.pack_end(loadLable)
        box.pack_end(wheel)
        box.pack_end(self.statusLabel)        
        box.pack_end(detailsbtn)
        box.show()

        return box
Пример #11
0
    def __init__(self):
        win = StandardWindow("Testing", "Elementary Tabbed Widget")
        # pylint: disable=no-member
        win.callback_delete_request_add(lambda o: elm.exit())

        tabbs = TabbedBox(win,
                          size_hint_weight=EXPAND_BOTH,
                          size_hint_align=FILL_BOTH)
        tabbs.close_cb = self.close_checks

        for i in range(10):
            lbl = Label(win)
            lbl.text = "Tab %s" % i
            lbl.show()
            tabbs.add(lbl, "Tab %s" % i)

        tabbs.disable(0)
        tabbs.disable(3)

        tabbs.show()

        win.resize_object_add(tabbs)

        win.resize(600, 400)
        win.show()
Пример #12
0
    def __init__(self, parent, label_text, values, initial_value):
        Box.__init__(self, parent)

        self.vd = {
            ELM_ACTIONSLIDER_LEFT: values[0],
            ELM_ACTIONSLIDER_CENTER: values[1],
            ELM_ACTIONSLIDER_RIGHT: values[2],
        }

        self.horizontal = True
        self.size_hint_align = -1.0, 0.0
        self.size_hint_weight = 1.0, 0.0

        l = Label(parent)
        l.text = label_text
        l.show()
        w = self.w = Actionslider(parent)
        w.magnet_pos = ELM_ACTIONSLIDER_ALL
        w.size_hint_align = -1.0, 0.0
        w.size_hint_weight = 1.0, 0.0
        w.show()

        parts = "left", "center", "right"

        for i, v in enumerate(values):
            w.part_text_set(parts[i], str(v))
        w.indicator_pos = values.index(initial_value) + 1

        self.pack_end(l)
        self.pack_end(w)
Пример #13
0
    def __init__(self, parent, title, done_cb, **kargs):
        self._user_cb = done_cb

        self._inwin = InnerWindow(parent)

        vbox = Box(self._inwin)
        self._inwin.content = vbox
        vbox.show()

        lb = Label(vbox, text='<b>%s</b>' % title)
        vbox.pack_end(lb)
        lb.show()

        Fileselector.__init__(self,
                              vbox,
                              expandable=False,
                              size_hint_weight=EXPAND_BOTH,
                              size_hint_align=FILL_BOTH,
                              **kargs)
        self.callback_done_add(self._fileselector_done_cb)
        self.callback_activated_add(self._fileselector_done_cb)
        # TODO this filter seems not to work well...need fixing
        # fs.mime_types_filter_append(list(EXTRACT_MAP.keys()), 'Archive files')
        # fs.mime_types_filter_append(['*'], 'All files')
        vbox.pack_end(self)
        self.show()

        self._inwin.activate()
Пример #14
0
 def display_error(self, exc):
     self.load_notify.content.delete()
     l = Label(self.load_notify,
               style="marker",
               text="Document load error: %s" % utf8_to_markup(str(exc)),
               color=(255, 0, 0, 255))
     self.load_notify.content = l
     l.show()
Пример #15
0
    def fileExists(self, filePath):

        self.confirmPopup = Popup(self.mainWindow,
                                  size_hint_weight=EXPAND_BOTH)

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

        # Add dialog-error Image to table
        need_ethumb()
        icon = Icon(self.confirmPopup, thumb='True')
        icon.standard_set('dialog-question')
        # 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.confirmPopup,
                                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.confirmPopup, line_wrap=ELM_WRAP_WORD,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH)
        current_file = os.path.basename(filePath)
        dialogLabel.text = "'%s' already exists. Overwrite?<br><br>" \
                           % (current_file)
        tb.pack(dialogLabel, 1, 0, 1, 1)
        dialogLabel.show()

        # Close without saving button
        no_btt = Button(self.mainWindow)
        no_btt.text = "No"
        no_btt.callback_clicked_add(self.closePopup, self.confirmPopup)
        no_btt.show()
        # Save the file and then close button
        sav_btt = Button(self.mainWindow)
        sav_btt.text = "Yes"
        sav_btt.callback_clicked_add(self.doSelected)
        sav_btt.callback_clicked_add(self.closePopup, self.confirmPopup)
        sav_btt.show()

        # add buttons to popup
        self.confirmPopup.part_content_set("button1", no_btt)
        self.confirmPopup.part_content_set("button3", sav_btt)
        self.confirmPopup.show()
    def __init__(self):
        StandardWindow.__init__(self, "ex1", "Hello Elementary", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hello Elementary!"
        ourLabel.show()
        
        self.resize_object_add(ourLabel)
    def __init__( self ):
        win = StandardWindow("Testing", "Elementary Sorted Table")
        win.callback_delete_request_add(lambda o: elm.exit())

        """Build the titles for the table. The titles is a list of tuples with the following format:
        
        ( <String - Header Text>, <Bool - Sortable> )"""
        titles = []
        for i in range(COLUMNS):
            titles.append(
                    ("Column " + str(i), True if i != 2 else False)
                    )

        #Create our sorted list object
        slist = SortedList(win, titles=titles, size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH)

        #Populate the rows in our table
        for i in range(ROWS):
            #Each row is a list with the number of elements that must equal the number of headers
            row = []
            for j in range(COLUMNS):
                #Row elements can be ANY elementary object
                if j == 0:
                    #For the first column in each row, we will create a button that will delete the row when pressed
                    btn = Button(slist, size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
                    btn.text = "Delete row"
                    btn.callback_clicked_add(
                        lambda x, y=row: slist.row_unpack(y, delete=True)
                        )
                    btn.show()
                    #Add the btn created to our row
                    row.append(btn)
                else:
                    #For each other row create a label with a random number
                    data = random.randint(0, ROWS*COLUMNS)
                    lb = Label(slist, size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
                    lb.text=str(data)
                    """For integer data we also need to assign value to "sort_data" because otherwise things get sorted as text"""
                    lb.data["sort_data"] = data
                    lb.show()
                    #Append our label to the row
                    row.append(lb)
            #Add the row into the SortedList
            slist.row_pack(row, sort=False)
        
        #Show the list
        slist.show()
        
        win.resize_object_add(slist)

        win.resize(600, 400)
        win.show()
Пример #18
0
Файл: gui.py Проект: wfx/epack
    def update_ui(self, listing_in_progress=False):
        box = self.header_box
        box.clear()
        ui_disabled = True

        # file listing in progress
        if listing_in_progress:
            spin = Progressbar(box, style='wheel', pulse_mode=True)
            spin.pulse(True)
            spin.show()
            box.pack_end(spin)

            lb = Label(box, text=_('Reading archive, please wait...'),
                       size_hint_weight=EXPAND_HORIZ,
                       size_hint_align=(0.0, 0.5))
            lb.show()
            box.pack_end(lb)

        # or header button
        else:
            if self.app.file_name is None:
                txt = _('No archive loaded, click to choose a file')
            else:
                ui_disabled = False
                txt = _('<b>Archive:</b> %s') % \
                      (os.path.basename(self.app.file_name))

            txt = '<align=left>%s</align>' % txt
            lb = Label(box, ellipsis=True, text=txt)
            bt = Button(box, content=lb, size_hint_weight=EXPAND_HORIZ,
                        size_hint_fill=FILL_HORIZ)
            bt.callback_clicked_add(lambda b: \
                        FileSelectorInwin(self, _('Choose an archive'),
                                          self._archive_selected_cb,
                                          path=os.getcwd()))
            box.pack_end(bt)
            bt.show()

        # always show the about button
        sep = Separator(box)
        box.pack_end(sep)
        sep.show()

        ic = SafeIcon(box, 'help-about', size_hint_min=(24,24))
        ic.callback_clicked_add(lambda i: InfoWin(self))
        box.pack_end(ic)
        ic.show()

        for widget in (self.extract_btn, self.fsb,
                       self.create_folder_chk, self.del_chk):
            widget.disabled = ui_disabled

        self.update_fsb_label()
Пример #19
0
class DestinationButton(Button):
    def __init__(self, app, parent):
        self.app = app
        self._text = ''

        Button.__init__(self,
                        parent,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_HORIZ)
        self.callback_clicked_add(self._btn_clicked_cb)

        box = Box(self, horizontal=True, padding=(3, 0))
        self.content = box
        box.show()

        icon = SafeIcon(box, 'folder', size_hint_min=(16, 16))
        box.pack_end(icon)
        icon.show()

        self.label = Label(box,
                           ellipsis=True,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_HORIZ)
        box.pack_end(self.label)
        self.label.show()

    def _btn_clicked_cb(self, btn):
        if os.path.isdir(self._text):
            path = self._text
        elif os.path.isdir(os.path.dirname(self._text)):
            path = os.path.dirname(self._text)
        else:
            path = os.getcwd()
        FileSelectorInwin(self.app.main_win,
                          _('Choose destination'),
                          self._fs_done_cb,
                          folder_only=True,
                          path=path)

    def _fs_done_cb(self, path):
        if path:
            self.app.dest_folder = path
            self.app.main_win.update_fsb_label()

    @property
    def text(self):
        return self._text

    @text.setter
    def text(self, text):
        self._text = text
        self.label.text = '<align=left>%s</align>' % text
Пример #20
0
    def __init__(self, parent, repo):
        self.repo = repo

        Popup.__init__(self, parent)
        self.part_text_set("title,text", "Add remote")

        tb = Table(self, padding=(3, 3), size_hint_expand=EXPAND_BOTH)
        self.content = tb
        tb.show()

        # name
        lb = Label(tb, text="Name")
        tb.pack(lb, 0, 0, 1, 1)
        lb.show()

        en = Entry(
            tb, editable=True, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH
        )
        en.part_text_set("guide", "Name for the new remote")
        en.callback_changed_user_add(lambda e: self.err_unset())
        tb.pack(en, 1, 0, 1, 1)
        en.show()
        self.name_entry = en

        # url
        lb = Label(tb, text="URL")
        tb.pack(lb, 0, 1, 1, 1)
        lb.show()

        en = Entry(
            tb, editable=True, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH
        )
        en.part_text_set("guide", "git://git.example.com/repo.git")
        en.callback_changed_user_add(lambda e: self.err_unset())
        tb.pack(en, 1, 1, 1, 1)
        en.show()
        self.url_entry = en

        # error label
        lb = Label(tb, text="", size_hint_expand=EXPAND_HORIZ)
        tb.pack(lb, 0, 2, 2, 1)
        lb.show()
        self.error_label = lb

        # buttons
        bt = Button(self, text="Cancel")
        bt.callback_clicked_add(lambda b: self.delete())
        self.part_content_set("button1", bt)
        bt.show()

        bt = Button(self, text="Add remote")
        bt.callback_clicked_add(self._add_btn_cb)
        self.part_content_set("button2", bt)
        bt.show()

        self.show()
Пример #21
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
Пример #22
0
    def addPackage(self, pak):
        row = []

        ourCheck = Check(self)
        ourCheck.data['packageName'] = pak.name
        ourCheck.callback_changed_add(self.app.checkChange)
        ourCheck.show()
        row.append(ourCheck)

        ourName = Button(self, style="anchor", size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=FILL_HORIZ)
        ourName.text = pak.name
        ourName.data["packageDes"] = pak.candidate.description
        ourName.callback_pressed_add(self.packagePressed)
        ourName.show()
        row.append(ourName)

        ourVersion = Label(self, size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=(0.1, 0.5))
        ourVersion.text = pak.installed.version
        ourVersion.show()
        row.append(ourVersion)

        newVersion = Label(self, size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=(0.1, 0.5))
        newVersion.text = pak.candidate.version
        newVersion.show()
        row.append(newVersion)

        self.app.packagesToUpdate[pak.name] = {'check':ourCheck, 'selected':False}
        self.packageList.row_pack(row, sort=False)
Пример #23
0
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()
Пример #24
0
    def popup_created(self, popup):
        super().popup_created(popup)

        # add all the available players to the popup edje box
        for player in self.mpris.players:
            self.popup_player_add(popup, player)

        # add all the channel sliders
        if self.pulse.conn is not None:
            for ch in self.pulse.channels:
                self.popup_volume_add(popup, ch)
        else:
            lb = Label(popup, text='Cannot connect to PulseAudio')
            lb.show()
            popup.part_box_append('volumes.box', lb)
Пример #25
0
    def __init__(self, parent, conf):
        Frame.__init__(self, parent)

        self.size_hint_align = -1.0, 0.0
        self.size_hint_weight = 1.0, 0.0
        self.text = "Data storage"

        self.conf = conf

        b = Box(parent)

        lbl = self.path_lbl = Label(parent)
        lbl.text = conf.get("Settings", "storage_path")

        self.dlsel = dlsel = FileselectorButton(self)
        dlsel.size_hint_align = -1.0, 0.0
        dlsel.inwin_mode = False
        dlsel.folder_only = True
        dlsel.expandable = False
        dlsel.text = "Change path"
        dlsel.path = conf.get("Settings", "storage_path")
        dlsel.callback_file_chosen_add(self.save_dlpath)

        for w in lbl, dlsel:
            w.show()
            b.pack_end(w)

        b.show()
        self.content = b
Пример #26
0
    def __init__(self, parent, doc_path, page_num, w, h, zoom=1.0):
        self.doc_path = doc_path
        self.page_num = page_num
        self.in_viewport = False

        evas = parent.evas
        super(Page, self).__init__(evas, self.SMART, parent=parent)

        self.page_num_label = Label(parent, text=str(page_num + 1))

        self.bg = Rectangle(evas, color=(255, 255, 255, 255))
        self.member_add(self.bg)
        self.bg.show()

        self.orig_w = float(w)
        self.orig_h = float(h)

        w = float(w) * zoom
        h = float(h) * zoom

        self.pv_img = FilledImage(evas, load_dpi=1, load_size=(w / 2, h / 2))
        self.member_add(self.pv_img)

        self.pv_img.on_image_preloaded_add(self.pv_preloaded)

        self.hq_img = FilledImage(evas, load_dpi=1, load_size=(w * 2, h * 2))
        self.member_add(self.hq_img)

        self.hq_img.on_image_preloaded_add(self.hq_preloaded, self.pv_img)

        self.size_hint_min = w, h

        self.pass_events = True
Пример #27
0
    def entryInit(self):
        self.mainEn = Entry(self.mainWindow, scrollable=True,
                            line_wrap=self.wordwrap, autosave=False,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.mainEn.callback_changed_user_add(self.textEdited)
        self.mainEn.elm_event_callback_add(self.eventsCb)
        self.mainEn.callback_clicked_add(resetCloseMenuCount)
        # delete line lable if it exist so we can create and add new one
        #    Later need to rethink logic here
        try:
            self.line_label.delete()
        except AttributeError:
            pass
        # Add label to show current cursor position
        if SHOW_POS:
            self.line_label = Label(self.mainWindow,
                                    size_hint_weight=EXPAND_HORIZ,
                                    size_hint_align=ALIGN_RIGHT)

            self.mainEn.callback_cursor_changed_add(self.curChanged,
                                                    self.line_label)
            self.curChanged(self.mainEn, self.line_label)
            self.line_label.show()
            self.mainBox.pack_end(self.line_label)
        # self.mainEn.markup_filter_append(self.textFilter)

        self.mainEn.show()
        self.mainEn.focus_set(True)
        try:
            self.mainBox.pack_before(self.mainEn, self.line_label)
        except AttributeError:
            # line_label has not been initialized on first run
            #   Should have better logic on all this
            self.mainBox.pack_end(self.mainEn)
Пример #28
0
def errorPopup(window, errorMsg):
    errorPopup = Popup(window, size_hint_weight=EXPAND_BOTH)
    errorPopup.callback_block_clicked_add(lambda obj: errorPopup.delete())

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

    # Add dialog-error Image to table
    need_ethumb()
    icon = Icon(errorPopup, thumb='True')
    icon.standard_set('dialog-warning')
    # 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(errorPopup,
                            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(errorPopup, line_wrap=ELM_WRAP_WORD,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH)
    dialogLabel.text = errorMsg
    tb.pack(dialogLabel, 1, 0, 1, 1)
    dialogLabel.show()

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

    # add button to popup
    errorPopup.part_content_set("button3", ok_btt)
    errorPopup.show()
Пример #29
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)
Пример #30
0
Файл: gui.py Проект: lonid/epack
class DestinationButton(Button):
    def __init__(self, app, parent):
        self.app = app
        self._text = ''

        Button.__init__(self, parent,size_hint_weight=EXPAND_HORIZ,
                                     size_hint_align=FILL_HORIZ)
        self.callback_clicked_add(self._btn_clicked_cb)

        box = Box(self, horizontal=True, padding=(3,0))
        self.content = box
        box.show()

        icon = Icon(box, standard='folder', size_hint_min=(16,16))
        box.pack_end(icon)
        icon.show()

        self.label = Label(box, ellipsis=True,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_HORIZ)
        box.pack_end(self.label)
        self.label.show()

    def _btn_clicked_cb(self, btn):
        if os.path.isdir(self._text):
            path = self._text
        elif os.path.isdir(os.path.dirname(self._text)):
            path = os.path.dirname(self._text)
        else:
            path = os.getcwd()
        FileSelectorInwin(self.app.main_win, _('Choose destination'),
                          self._fs_done_cb, folder_only=True,
                          path=path)

    def _fs_done_cb(self, path):
        if path:
            self.app.dest_folder = path
            self.app.main_win.update_fsb_label()

    @property
    def text(self):
        return self._text

    @text.setter
    def text(self, text):
        self._text = text
        self.label.text = '<align=left>%s</align>' % text
Пример #31
0
def clicked_mouse(event):
    print(event)
    print()
    if (event.buttons == 3):
        dia = StandardWindow("window-dia",
                             "DialogWindow",
                             size=(400, 40),
                             autodel=True)

        lb = Label(dia,
                   text="This is a DialogWindow",
                   size_hint_weight=EXPAND_BOTH)
        dia.resize_object_add(lb)
        lb.show()
        #       dia.borderless_set(1)
        dia.show()
    return ecore.ECORE_CALLBACK_PASS_ON
Пример #32
0
def cb_menu_overlay_bubble(menu, item, Map, lon, lat):
    ov = Map.overlay_add(lon, lat)
    bub = Map.overlay_bubble_add()
    bub.follow(ov)

    lb = Label(Map, text="You can push contents here")
    bub.content_append(lb)
    lb.show()

    ic = Icon(Map, file=os.path.join(img_path, "sky_01.jpg"))
    ic.size_hint_min = 50, 50
    bub.content_append(ic)
    ic.show()

    bt = Button(Map, text="clear me")
    bt.callback_clicked_add(lambda bt:bub.content_clear())
    bub.content_append(bt)
    bt.show()
Пример #33
0
    def __init__(self, parent, text=None, title=None):
        Popup.__init__(self, parent)
        self.part_text_set('title,text', title or 'Please wait')

        box = Box(self, horizontal=True, padding=(6,6))
        self.content = box
        box.show()

        wheel = Progressbar(self, style='wheel', pulse_mode=True)
        wheel.pulse(True)
        box.pack_end(wheel)
        wheel.show()

        lb = Label(self, text=text or 'Operation in progress...')
        box.pack_end(lb)
        lb.show()

        self.show()
Пример #34
0
def inner_window_clicked(obj):
    win = StandardWindow("inner-window", "InnerWindow test", autodel=True,
        size=(320, 320))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    lb = Label(win)
    lb.text_set("This is an \"inwin\" - a window in a<br/>"
                "window. This is handy for quick popups<br/>"
                "you want centered, taking over the window<br/>"
                "until dismissed somehow. Unlike hovers they<br/>"
                "don't hover over their target.")

    iw = InnerWindow(win, content=lb)
    iw.show()

    win.resize(320, 320)
    win.show()
Пример #35
0
    def sort_by_column(self, col, ascending=True):

        assert col >= 0
        assert col < len(self.header_row)

        self.header_row[self.sort_column].icon = None

        btn = self.header_row[col]
        ic = Label(btn)
        btn.part_content_set("icon", ic)
        ic.show()

        if ascending == True: #ascending:
            ic.text = u"⬇"
            self.sort_column_ascending = True
        else:
             ic.text = u"⬆"
             self.sort_column_ascending = False

        orig_col = [
            (i, x[col].data.get("sort_data", x[col].text)) \
            for i, x in enumerate(self.rows)
            ]
        sorted_col = sorted(orig_col, key=lambda e: e[1])
        new_order = [x[0] for x in sorted_col]

        # print(new_order)

        if not ascending:
             new_order.reverse()

        # print(new_order)

        for bx in self.lists:
            bx.unpack_all()

        for new_y in new_order:
            self.add_row(self.rows[new_y])

        self.rows.sort(
            key=lambda e: e[col].data.get("sort_data", e[col].text),
            #reverse=False if ascending else True
            )
        self.sort_column = col
Пример #36
0
    def __init__( self ):
        win = StandardWindow("Testing", "Elementary About Dialog")
        win.callback_delete_request_add(lambda o: elm.exit())
        win.show()
        
        lbl = Label(win, size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH)
        lbl.text = "This is a parent window for the About Dialog. Close when done."
        lbl.show()
        
        win.resize_object_add(lbl)

        win.resize(600, 400)
        win.show()
        
        AboutWindow(win, title="About Test", standardicon="dialog-information", \
                        version="1.0", authors=AUTHORS, \
                        licen=LICENSE, webaddress="https://github.com/JeffHoogland/python-elm-extensions", \
                        info=INFO)
Пример #37
0
    def __init__(self):
        self.cfg = ConfigOption()
        self.userid = os.getuid()
        self.win = None
        self.bg = None
        self.main_box = None
        self.info_frame = None
        self.lb = None
        self.ps_list = None

        self.win = StandardWindow("my app", "eyekill", size=(320, 384))
        self.win.title_set("eye kill")
        self.win.callback_delete_request_add(self.destroy)

        self.main_box = Box(self.win)
        self.main_box.size_hint_weight = EXPAND_BOTH
        self.win.resize_object_add(self.main_box)
        self.main_box.show()

        self.info_frame = Frame(self.win)
        self.info_frame.text_set("Information")
        self.main_box.pack_end(self.info_frame)
        self.info_frame.show()

        self.lb = Label(self.win)
        self.lb.text_set('<b>Kill process with a double click</b>')
        self.info_frame.content_set(self.lb)
        self.lb.show()

        self.ps_list = List(self.win)
        self.ps_list.size_hint_weight = EXPAND_BOTH
        self.ps_list.size_hint_align = FILL_BOTH
        self.ps_list.callback_clicked_double_add(self.kill_bill)

        self.update_list()

        self.main_box.pack_end(self.ps_list)
        self.ps_list.go()
        self.ps_list.show()

        self.win.resize(320, 384)
        self.win.show()
Пример #38
0
    def __init__(self, parent, done_cb, title, text=None, guide=None, not_empty=True):
        self.done_cb = done_cb

        Popup.__init__(self, parent)
        self.part_text_set('title,text', title)

        box = Box(self, padding=(0,4))
        self.content = box
        box.show()

        if text:
            lb = Label(self, text=text)
            box.pack_end(lb)
            lb.show()

        en = Entry(self, single_line=True, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        if guide is not None:
            en.part_text_set('guide', guide)
        box.pack_end(en)
        en.show()

        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
        box.pack_end(sep)
        sep.show()

        b = Button(self, text='Cancel')
        b.callback_clicked_add(lambda b: self.delete())
        self.part_content_set('button1', b)
        b.show()
        
        b = Button(self, text='OK', disabled=not_empty)
        b.callback_clicked_add(self._confirmed_cb, en, done_cb)
        self.part_content_set('button2', b)
        b.show()

        if not_empty is True:
            en.callback_changed_user_add(self._entry_changed, b)

        en.focus = True
        self.show()
Пример #39
0
        def worker_check(t):
            if t.is_alive():
                return True
            if self.doc and self.page_count:
                spn.special_value_add(self.page_count, "Last")
                spn.min_max = (1, self.page_count)

                if self.doc.isEncrypted:
                    PasswordPrompt(self)
                    return False

                self.metadata_read()
                self.populate_pages()
                return False

            self.load_notify.content.delete()
            l = Label(
                self.load_notify, style="marker",
                text="Document load error", color=(255, 0, 0, 255))
            self.load_notify.content = l
            l.show()
    def __init__(self):
        StandardWindow.__init__(self,
                                "ex2",
                                "Hello Elementary",
                                size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hello Elementary!"
        ourLabel.show()

        ourButton = Button(self)
        ourButton.size_hint_weight = EXPAND_BOTH
        ourButton.text = "Goodbye Elementary"
        ourButton.callback_clicked_add(self.buttonPressed)
        ourButton.show()

        ourBox = Box(self)
        ourBox.size_hint_weight = EXPAND_BOTH
        ourBox.pack_end(ourLabel)
        ourBox.pack_end(ourButton)
        ourBox.show()

        self.resize_object_add(ourBox)
    def sort_by_column(self, col, ascending=True):

        assert col >= 0
        assert col < len(self.header_row)

        self.header_row[self.sort_column].icon = None

        btn = self.header_row[col]
        ic = Label(btn)
        btn.part_content_set("icon", ic)
        ic.show()

        if ascending == True:  #ascending:
            ic.text = u"⬇"
            self.sort_column_ascending = True
        else:
            ic.text = u"⬆"
            self.sort_column_ascending = False

        self.rows.sort(key=lambda e: e[col],
                       #reverse=False if ascending else True
                       )

        if not ascending:
            self.rows.reverse()

        #Clear old data
        for our_list in self.lists:
            our_list.clear()

        for row in self.rows:
            self.add_row(row)

        self.sort_column = col
    def sort_by_column(self, col, ascending=True):
        ''' utility to sort list on columns '''
        assert col >= 0
        assert col < len(self.header_row)

        self.header_row[self.sort_column].icon = None

        btn = self.header_row[col]
        _ic = Label(btn)
        btn.part_content_set("icon", _ic)
        _ic.show()

        if ascending:  # ascending:
            _ic.text = "⬇"
            self.sort_column_ascending = True
        else:
            _ic.text = "⬆"
            self.sort_column_ascending = False
        # reverse=False if ascending else True
        self.rows.sort(key=lambda e: e[col])

        if not ascending:
            self.rows.reverse()

        # Clear old data
        for our_list in self.lists:
            our_list.clear()

        for row in self.rows:
            self.add_row(row)

        self.sort_column = col
    def __init__( self ):
        win = StandardWindow("Testing", "Elementary Tabbed Widget")
        win.callback_delete_request_add(lambda o: elm.exit())

        tabbs = TabbedBox(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        tabbs.closeCallback = self.closeChecks
        
        for i in range(10):
            lbl = Label(win)
            lbl.text = "Tab %s"%i
            lbl.show()
            tabbs.addTab(lbl, "Tab %s"%i)
        
        tabbs.disableTab(0)
        tabbs.disableTab(3)
        
        tabbs.show()
        
        win.resize_object_add(tabbs)

        win.resize(600, 400)
        win.show()
    def __init__(self):
        StandardWindow.__init__(self, "ex2", "Hello Elementary", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hello Elementary!"
        ourLabel.show()
        
        ourButton = Button(self)
        ourButton.size_hint_weight = EXPAND_BOTH
        ourButton.text = "Goodbye Elementary"
        ourButton.callback_clicked_add(self.buttonPressed)
        ourButton.show()
        
        ourBox = Box(self)
        ourBox.size_hint_weight = EXPAND_BOTH
        ourBox.pack_end(ourLabel)
        ourBox.pack_end(ourButton)
        ourBox.show()
        
        self.resize_object_add(ourBox)
Пример #45
0
def cnp_clicked(obj):
    win = StandardWindow("copypaste", "CopyPaste", autodel=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    gd = Grid(win, size=(100, 100), size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(gd)
    gd.show()

    en = Entry(win, scrollable=True, line_wrap=ELM_WRAP_CHAR,
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        text="Elementary provides ")
    gd.pack(en, 10, 10, 60, 30)
    en.show()

    bt = Button(win, text="Copy from left entry")
    bt.callback_clicked_add(bt_copy_clicked, en)
    gd.pack(bt, 70, 10, 22, 30)
    bt.show()

    bt = Button(win, text="Clear clipboard")
    bt.callback_clicked_add(bt_clear_clicked, en)
    gd.pack(bt, 70, 70, 22, 20)
    bt.show()

    en = Entry(win, scrollable=True, line_wrap=ELM_WRAP_CHAR,
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        text="rich copying and pasting functionality,")
    gd.pack(en, 10, 40, 60, 30)
    en.show()

    bt = Button(win, text="Paste to left entry")
    bt.callback_clicked_add(bt_paste_clicked, en)
    gd.pack(bt, 70, 40, 22, 30)
    bt.show()

    lb = Label(win, text="<b>Clipboard:</b>", size_hint_weight=(0.0, 0.0),
        size_hint_align=FILL_BOTH)
    gd.pack(lb, 10, 70, 60, 10)
    lb.show()

    global glb
    glb = Label(win, text="", size_hint_weight=(0.0, 0.0),
        size_hint_align=FILL_BOTH)
    gd.pack(glb, 10, 80, 60, 10)
    glb.show()

    win.size = 480, 200
    win.show()
Пример #46
0
Файл: gui.py Проект: lonid/epack
    def ask_what_to_do_next(self):
        pop = Popup(self)
        pop.part_text_set('title,text', _('Extract completed'))

        box = Box(pop)
        pop.content = box
        box.show()

        lb = Label(pop, text=_('What to do next?'),
                   size_hint_align=FILL_HORIZ)
        box.pack_end(lb)
        lb.show()

        btn = Button(pop, text=_('Open Filemanager'),
                     size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(self._open_fm_and_exit_cb)
        box.pack_end(btn)
        btn.show()

        btn = Button(pop, text=_('Open Terminal'),
                     size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(self._open_term_and_exit_cb)
        box.pack_end(btn)
        btn.show()

        btn = Button(pop, text=_('Close this popup'),
                     size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: pop.delete())
        box.pack_end(btn)
        btn.show()

        btn = Button(pop, text=_('Exit'),
                     size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: self.app.exit())
        box.pack_end(btn)
        btn.show()

        pop.show()
Пример #47
0
    def addPackage(self, pak):
        row = []

        ourCheck = Check(self)
        ourCheck.data['packageName'] = pak.name
        ourCheck.callback_changed_add(self.app.checkChange)
        ourCheck.show()
        row.append(ourCheck)

        ourName = Button(self,
                         style="anchor",
                         size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=FILL_HORIZ)
        ourName.text = pak.name
        ourName.data["packageDes"] = pak.candidate.description
        ourName.callback_pressed_add(self.packagePressed)
        ourName.show()
        row.append(ourName)

        ourVersion = Label(self,
                           size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=(0.1, 0.5))
        ourVersion.text = pak.installed.version
        ourVersion.show()
        row.append(ourVersion)

        newVersion = Label(self,
                           size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=(0.1, 0.5))
        newVersion.text = pak.candidate.version
        newVersion.show()
        row.append(newVersion)

        self.app.packagesToUpdate[pak.name] = {
            'check': ourCheck,
            'selected': False
        }
        self.packageList.row_pack(row, sort=False)
Пример #48
0
    def __init__(self):
        self.win = StandardWindow("test", "Toolbar_issue",
            size=(600, 400))
        self.win.callback_delete_request_add(lambda x: elementary.exit())

        box0 = Box(self.win)
        #, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
        self.win.resize_object_add(box0)
        box0.show()

        tb = Toolbar(self.win, homogeneous=True,
                size_hint_weight=EXPAND_HORIZ, size_hint_align=(EVAS_HINT_FILL, 0.0),
                select_mode=ELM_OBJECT_SELECT_MODE_DEFAULT)
        self.menuItem = tb.item_append("document-save", "Save", self.popup)
        tb.show()
        box0.pack_end(tb)

        lb = Label(self.win) 
        lb.text_set("<br>This is a test program to illustrate a problem <br>"
                    "with the Radiance e19 theme.<br><br>"
                    "Disabling a toolbar item and then re-enabling it does not<br>"
                    "re-enable the toolbar item's <i>callback function</i>.<br><br>"
                    "To test this first click <b>Save</b> when this program is opened<br>"
                    "This opens a popup as expected. Dismiss popup.<br><br>"
                    "Now click the <b>Toggle</b> button to disable <b>Save</b> Toolbar Item<br>"
                    "After this the <b>Save</b> button is disabled and 'looks different'<br><br>"
                    "Click the <b>Toggle</b> button again to enable <b>Save</b><br>"
                    "After this clicking <b>Save</b> does nothing even tho it 'looks' enabled<br><br>"
                    )
        lb.show()
        box0.pack_end(lb)

        testButton = Button(self.win, text="Toogle")
        testButton.callback_clicked_add(self.disable)
        testButton.show()
        box0.pack_end(testButton)

        self.win.show()
Пример #49
0
    def ask_what_to_do_next(self):
        pop = Popup(self)
        pop.part_text_set('title,text', _('Extract completed'))

        box = Box(pop)
        pop.content = box
        box.show()

        lb = Label(pop, text=_('What to do next?'), size_hint_align=FILL_HORIZ)
        box.pack_end(lb)
        lb.show()

        btn = Button(pop,
                     text=_('Open Filemanager'),
                     size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(self._open_fm_and_exit_cb)
        box.pack_end(btn)
        btn.show()

        btn = Button(pop, text=_('Open Terminal'), size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(self._open_term_and_exit_cb)
        box.pack_end(btn)
        btn.show()

        btn = Button(pop,
                     text=_('Close this popup'),
                     size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: pop.delete())
        box.pack_end(btn)
        btn.show()

        btn = Button(pop, text=_('Exit'), size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: self.app.exit())
        box.pack_end(btn)
        btn.show()

        pop.show()
Пример #50
0
class DagGraph(Box):
    def __init__(self, parent, app):
        Box.__init__(self, parent)

        # header
        self.label_top = Label(self, ellipsis=True,
                               size_hint_expand=EXPAND_HORIZ,
                               size_hint_fill=FILL_HORIZ)
        self.pack_end(self.label_top)
        self.label_top.show()

        # genlist
        self.genlist = DagGraphList(self, app)
        self.pack_end(self.genlist)
        self.genlist.show()

        # footer
        self.label = Label(self, ellipsis=True,
                           size_hint_expand=EXPAND_HORIZ,
                           size_hint_fill=FILL_HORIZ)
        self.pack_end(self.label)
        self.label.show()

        #
        self.show()

    def populate(self, *args, **kargs):
        self.genlist.populate(*args, **kargs)

    def update(self):
        self.genlist.update()

    def header_label_set(self, text):
        self.label_top.text = '<align=left><big>' + text + '</big></align>'

    def info_label_set(self, text):
        self.label.text = '<align=left>' + text + '</align>'
    def __init__(self):
        win = StandardWindow("Testing", "Elementary Sorted Table")
        # pylint: disable=no-member
        win.callback_delete_request_add(lambda o: elm.exit())
        # Build the titles for the table. The titles is a list of tuples
        #   with the following format:
        #       ( <str - Header Text>, <Bool - Sortable> )'''
        titles = []
        for i in range(COLUMNS):
            titles.append(("Column " + str(i), True if i != 2 else False))

        # Create our sorted list object
        slist = SortedList(win,
                           titles=titles,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)

        # Populate the rows in our table
        for _i in range(ROWS):
            # Each row is a list with the number of elements
            #   that must equal the number of headers
            row = []
            for j in range(COLUMNS):
                # Row elements can be ANY elementary object
                if j == 0:
                    # For the first column in each row, we will create a button
                    #    that will delete the row when pressed
                    btn = Button(slist,
                                 size_hint_weight=EXPAND_BOTH,
                                 size_hint_align=FILL_BOTH)
                    btn.text = "Delete row"
                    btn.callback_clicked_add(
                        lambda x, y=row: slist.row_unpack(y, delete=True))
                    btn.show()
                    # Add the btn created to our row
                    row.append(btn)
                else:
                    # For each other row create a label with a random number
                    data = random.randint(0, ROWS * COLUMNS)
                    label = Label(slist,
                                  size_hint_weight=EXPAND_BOTH,
                                  size_hint_align=FILL_BOTH)
                    label.text = str(data)
                    # For integer data we also need to assign value to "sort_data"
                    #     because otherwise things get sorted as text
                    label.data["sort_data"] = data
                    label.show()
                    # Append our label to the row
                    row.append(label)
            # Add the row into the SortedList
            slist.row_pack(row, sort=False)

        # Show the list
        slist.show()
        win.resize_object_add(slist)
        win.resize(600, 400)
        win.show()
Пример #52
0
    def __init__(self, app, parent):
        self.app = app
        self._text = ''

        Button.__init__(self,
                        parent,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_HORIZ)
        self.callback_clicked_add(self._btn_clicked_cb)

        box = Box(self, horizontal=True, padding=(3, 0))
        self.content = box
        box.show()

        icon = SafeIcon(box, 'folder', size_hint_min=(16, 16))
        box.pack_end(icon)
        icon.show()

        self.label = Label(box,
                           ellipsis=True,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_HORIZ)
        box.pack_end(self.label)
        self.label.show()
Пример #53
0
    def update_ui(self, listing_in_progress=False):
        box = self.header_box
        box.clear()
        ui_disabled = True

        # file listing in progress
        if listing_in_progress:
            spin = Progressbar(box, style='wheel', pulse_mode=True)
            spin.pulse(True)
            spin.show()
            box.pack_end(spin)

            lb = Label(box,
                       text=_('Reading archive, please wait...'),
                       size_hint_weight=EXPAND_HORIZ,
                       size_hint_align=(0.0, 0.5))
            lb.show()
            box.pack_end(lb)

        # or header button
        else:
            if self.app.file_name is None:
                txt = _('No archive loaded, click to choose a file')
            else:
                ui_disabled = False
                txt = _('<b>Archive:</b> %s') % \
                      (os.path.basename(self.app.file_name))

            txt = '<align=left>%s</align>' % txt
            lb = Label(box, ellipsis=True, text=txt)
            bt = Button(box,
                        content=lb,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_fill=FILL_HORIZ)
            bt.callback_clicked_add(lambda b: \
                        FileSelectorInwin(self, _('Choose an archive'),
                                          self._archive_selected_cb,
                                          path=os.getcwd()))
            box.pack_end(bt)
            bt.show()

        # always show the about button
        sep = Separator(box)
        box.pack_end(sep)
        sep.show()

        ic = SafeIcon(box, 'help-about', size_hint_min=(24, 24))
        ic.callback_clicked_add(lambda i: InfoWin(self))
        box.pack_end(ic)
        ic.show()

        for widget in (self.extract_btn, self.fsb, self.create_folder_chk,
                       self.del_chk):
            widget.disabled = ui_disabled

        self.update_fsb_label()
    def __init__(self):
        StandardWindow.__init__(self, "ex7", "Naviframe", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        staticImage = staticImage = Image(self)
        staticImage.size_hint_weight = EXPAND_BOTH
        staticImage.file_set("images/logo.png")
        staticImage.tooltip_text_set("A picture!")
        staticImage.show()

        ourLabel = ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hey look some text!"
        ourLabel.show()

        self.nf = Naviframe(self)
        self.nf.size_hint_weight = EXPAND_BOTH
        self.nf.size_hint_align = FILL_BOTH
        self.nf.show()

        buttonOne = Button(self)
        buttonOne.size_hint_weight = EXPAND_BOTH
        buttonOne.text = "Show image"
        buttonOne.callback_clicked_add(self.buttonPressed, staticImage)
        buttonOne.show()

        buttonTwo = Button(self)
        buttonTwo.size_hint_weight = EXPAND_BOTH
        buttonTwo.text = "Show label"
        buttonTwo.callback_clicked_add(self.buttonPressed, ourLabel)
        buttonTwo.show()

        buttonBox = Box(self)
        buttonBox.size_hint_weight = EXPAND_HORIZ
        buttonBox.horizontal_set(True)
        buttonBox.pack_end(buttonOne)
        buttonBox.pack_end(buttonTwo)
        buttonBox.show()

        mainBox = Box(self)
        mainBox.size_hint_weight = EXPAND_BOTH
        mainBox.pack_end(self.nf)
        mainBox.pack_end(buttonBox)
        mainBox.show()

        self.nf.item_simple_push(staticImage)

        self.resize_object_add(mainBox)
Пример #55
0
    def __init__(self):
        StandardWindow.__init__(self, "ex1", "Hello Elementary", size=(640, 480))
        self.callback_delete_request_add(lambda o: elm.exit())

        ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hello Elementary!"
        ourLabel.show()

        self.resize_object_add(ourLabel)
Пример #56
0
    def sort_by_column(self, col, ascending=True):

        assert col >= 0
        assert col < len(self.header_row)

        self.header_row[self.sort_column].icon = None

        btn = self.header_row[col]
        ic = Label(btn)
        btn.part_content_set("icon", ic)
        ic.show()

        if ascending == True:  #ascending:
            ic.text = u"⬇"
            self.sort_column_ascending = True
        else:
            ic.text = u"⬆"
            self.sort_column_ascending = False

        orig_col = [
            (i, x[col].data.get("sort_data", x[col].text)) \
            for i, x in enumerate(self.rows)
            ]
        sorted_col = sorted(orig_col, key=lambda e: e[1])
        new_order = [x[0] for x in sorted_col]

        # print(new_order)

        if not ascending:
            new_order.reverse()

        # print(new_order)

        for bx in self.lists:
            bx.unpack_all()

        for new_y in new_order:
            self.add_row(self.rows[new_y])

        self.rows.sort(key=lambda e: e[col].data.get("sort_data", e[col].text),
                       #reverse=False if ascending else True
                       )
        self.sort_column = col
Пример #57
0
    def buildLoadBox(self):
        # build the load label
        loadLable = Label(self,
                          size_hint_weight=EXPAND_BOTH,
                          size_hint_align=FILL_HORIZ)
        loadLable.text = "<b>Processing</b>"
        loadLable.show()

        # build the spinning wheel
        wheel = Progressbar(self,
                            pulse_mode=True,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_HORIZ)
        wheel.pulse(True)
        wheel.show()

        detailsbtn = Button(self, style="anchor")
        detailsbtn.text_set("Details")
        detailsbtn.callback_pressed_add(self.innerWinShow)
        detailsbtn.show()

        # build the status label
        self.statusLabel = Label(self,
                                 size_hint_weight=EXPAND_BOTH,
                                 size_hint_align=FILL_HORIZ)
        self.statusLabel.show()

        # put all the built objects in a vertical box
        box = Box(self,
                  size_hint_weight=EXPAND_BOTH,
                  size_hint_align=FILL_BOTH)
        box.pack_end(loadLable)
        box.pack_end(wheel)
        box.pack_end(self.statusLabel)
        box.pack_end(detailsbtn)
        box.show()

        return box