예제 #1
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
예제 #2
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
예제 #3
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
예제 #4
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()
예제 #5
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()
예제 #6
0
def image_clicked(obj):
    win = StandardWindow("image", "Image test", autodel=True, size=(320, 480))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        file=os.path.join(img_path, "logo.png"))
    vbox.pack_end(im)
    im.show()

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

    hbox = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL,
        size_hint_align=FILL_BOTH)
    vbox.pack_end(hbox)
    hbox.show()

    for rot in orients:
        b = Button(win, text=rot[0])
        hbox.pack_end(b)
        b.callback_clicked_add(lambda b, y=rot[1]: im.orient_set(y))
        b.show()

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

    hbox = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    vbox.pack_end(hbox)
    hbox.show()

    b = Button(win, text="Set remote URL")
    hbox.pack_end(b)
    b.callback_clicked_add(lambda b: im.file_set(remote_url))
    b.show()

    pb = Progressbar(win, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    hbox.pack_end(pb)
    pb.show()

    im.callback_download_start_add(_cb_im_download_start, pb)
    im.callback_download_done_add(_cb_im_download_done)
    im.callback_download_progress_add(_cb_im_download_progress, pb)
    im.callback_download_error_add(_cb_im_download_error, pb)

    win.show()
예제 #7
0
파일: utils.py 프로젝트: DaveMDS/egitu
    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()
예제 #8
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
예제 #9
0
파일: utils.py 프로젝트: DaveMDS/egitu
class CommandOutputEntry(Table):
    def __init__(self, parent, min_size=(0,0)):
        Table.__init__(self, parent, size_hint_expand=EXPAND_BOTH, 
                       size_hint_fill=FILL_BOTH)
        
        self._entry = Entry(self, scrollable=True, editable=False,
                            line_wrap=ELM_WRAP_NONE, 
                            size_hint_expand=EXPAND_BOTH, 
                            size_hint_fill=FILL_BOTH)

        self._wheel = Progressbar(self, style='wheel', pulse_mode=True,
                                  size_hint_expand=EXPAND_BOTH)

        self._rect = Rectangle(self.evas, size_hint_min=min_size,
                               size_hint_expand=EXPAND_BOTH, color=(0,0,0,0))

        self.pack(self._entry, 0, 0, 1, 1)
        self.pack(self._rect,  0, 0, 1, 1)
        self.pack(self._wheel, 0, 0, 1, 1)

        self._last_was_carriage = False
        self._entry.show()
        self._rect.show()
        self.show()

    @property
    def text(self):
        return self._entry.text
    @text.setter
    def text(self, text):
        self._entry.text = text

    def pulse_start(self):
        self._rect.repeat_events = False
        self._wheel.pulse(True)
        self._wheel.show()

    def pulse_stop(self):
        self._rect.repeat_events = True
        self._wheel.pulse(False)
        self._wheel.hide()

    def successfull(self):
        self._entry.entry_append('<success>Operation successfully completed.</success><br>')
    
    def failure(self):
        self._entry.entry_append('<failure>Error! Something goes wrong.</failure><br>')
    
    def error_set(self, text):
        self._entry.text = '<failure>Error:</failure><br>%s' % text

    def append_raw(self, line, sep=None):
        if self._last_was_carriage is True:
            self._entry.cursor_selection_begin()
            self._entry.cursor_line_end_set()
            self._entry.cursor_selection_end()
            self._entry.entry_insert('')
        if sep == '\n':
            self._entry.entry_append(line + '<br>')
            self._entry.cursor_end_set()
            self._last_was_carriage = False
        elif sep == '\r':
            self._entry.entry_append(line)
            self._last_was_carriage = True
        else:
            self._entry.entry_append(line)
            self._last_was_carriage = False
def progressbar_clicked(obj):
    win = StandardWindow("progressbar", "Progressbar test")
    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()

    pb1 = Progressbar(win, span_size=300, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_HORIZ)
    bx.pack_end(pb1)
    pb1.show()

    pb2 = Progressbar(win, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_HORIZ, text="Infinite bounce", pulse_mode=True)
    bx.pack_end(pb2)
    pb2.show()

    ic1 = Icon(win, file=os.path.join(img_path, "logo_small.png"),
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))

    pb3 = Progressbar(win, text="Inverted", content=ic1, inverted=True,
        unit_format="%1.1f units", size_hint_align=FILL_HORIZ,
        size_hint_weight=EXPAND_BOTH)
    bx.pack_end(pb3)
    ic1.show()
    pb3.show()

    pb8 = Progressbar(win, style="double", text="Style: double",
        size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_BOTH)
    bx.pack_end(pb8)
    pb8.show()

    hbx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    bx.pack_end(hbx)
    hbx.show()

    pb4 = Progressbar(win, horizontal=False, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH, span_size=60, text="Vertical")
    hbx.pack_end(pb4)
    pb4.show()

    pb5 = Progressbar(win, horizontal=False, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_HORIZ, span_size=120, pulse_mode=True,
        unit_format=None, text="Infinite bounce")
    hbx.pack_end(pb5)
    pb5.show()

    ic2 = Icon(win, file=os.path.join(img_path, "logo_small.png"),
        size_hint_aspect=(EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1))

    pb6 = Progressbar(win, horizontal=False, text="Inverted", content=ic2,
        inverted=True, unit_format="%1.2f%%", span_size=200,
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ)
    hbx.pack_end(pb6)
    ic2.show()
    pb6.show()

    pb7 = Progressbar(win, style="wheel", text="Style: wheel", pulse_mode=True,
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ)
    bx.pack_end(pb7)
    pb7.show()

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

    pbt = (pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8)

    bt = Button(win, text="Start")
    bt.callback_clicked_add(begin_test, *pbt)
    bt_bx.pack_end(bt)
    bt.show()

    bt = Button(win, text="Stop")
    bt.callback_clicked_add(end_test, *pbt)
    bt_bx.pack_end(bt)
    bt.show()

    win.callback_delete_request_add(clean_up, *pbt)
    win.show()
예제 #11
0
def progressbar_clicked(obj):
    win = StandardWindow("progressbar", "Progressbar test")
    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()

    pb1 = Progressbar(win,
                      span_size=300,
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_HORIZ)
    bx.pack_end(pb1)
    pb1.show()

    pb2 = Progressbar(win,
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_HORIZ,
                      text="Infinite bounce",
                      pulse_mode=True)
    bx.pack_end(pb2)
    pb2.show()

    ic1 = Icon(win,
               file=os.path.join(img_path, "logo_small.png"),
               size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))

    pb3 = Progressbar(win,
                      text="Inverted",
                      content=ic1,
                      inverted=True,
                      unit_format="%1.1f units",
                      size_hint_align=FILL_HORIZ,
                      size_hint_weight=EXPAND_BOTH)
    bx.pack_end(pb3)
    ic1.show()
    pb3.show()

    pb8 = Progressbar(win,
                      style="double",
                      text="Style: double",
                      size_hint_align=FILL_HORIZ,
                      size_hint_weight=EXPAND_BOTH)
    bx.pack_end(pb8)
    pb8.show()

    hbx = Box(win,
              horizontal=True,
              size_hint_weight=EXPAND_BOTH,
              size_hint_align=FILL_BOTH)
    bx.pack_end(hbx)
    hbx.show()

    pb4 = Progressbar(win,
                      horizontal=False,
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH,
                      span_size=60,
                      text="Vertical")
    hbx.pack_end(pb4)
    pb4.show()

    pb5 = Progressbar(win,
                      horizontal=False,
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_HORIZ,
                      span_size=120,
                      pulse_mode=True,
                      unit_format=None,
                      text="Infinite bounce")
    hbx.pack_end(pb5)
    pb5.show()

    ic2 = Icon(win,
               file=os.path.join(img_path, "logo_small.png"),
               size_hint_aspect=(EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1))

    pb6 = Progressbar(win,
                      horizontal=False,
                      text="Inverted",
                      content=ic2,
                      inverted=True,
                      unit_format="%1.2f%%",
                      span_size=200,
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_HORIZ)
    hbx.pack_end(pb6)
    ic2.show()
    pb6.show()

    pb7 = Progressbar(win,
                      style="wheel",
                      text="Style: wheel",
                      pulse_mode=True,
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_HORIZ)
    bx.pack_end(pb7)
    pb7.show()

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

    pbt = (pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8)

    bt = Button(win, text="Start")
    bt.callback_clicked_add(begin_test, *pbt)
    bt_bx.pack_end(bt)
    bt.show()

    bt = Button(win, text="Stop")
    bt.callback_clicked_add(end_test, *pbt)
    bt_bx.pack_end(bt)
    bt.show()

    win.callback_delete_request_add(clean_up, *pbt)
    win.show()