예제 #1
0
 def __init__(self, rent):
     Box.__init__(self, rent)
     self.parent = rent
     
     #This appears on the button in the main swmai window
     self.name = "Startup Applications"
     #The section in the main window the button is added to
     self.section = "Applications"
     #Search terms that this module should appear for
     self.searchData = ["startup", "command", "applications", "apps"]
     #Command line argument to open this module directly
     self.launchArg = "--startupapps"
     #Should be none by default. This value is used internally by swami
     self.button = None
     
     self.icon = Icon(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
     self.icon.standard_set('system-run')
     self.icon.show()
     
     self.mainBox = Box(self, size_hint_weight = EXPAND_BOTH)
     self.mainBox.show()
     
     buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
     buttonBox.horizontal = True
     
     buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed)
     buttonReturn.show()
     
     buttonBox.pack_end(buttonReturn)
     buttonBox.show()
     
     self.pack_end(self.mainBox)
     self.pack_end(buttonBox)
    def __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 __init__(self, rent):
     Box.__init__(self, rent)
     self.parent = rent
     
     #This appears on the button in the main swmai window
     self.name = "Light DM"
     #The section in the main window the button is added to
     self.section = "System Settings"
     #Search terms that this module should appear for
     self.searchData = ["lightdm", "autologin", "login", "display"]
     #Command line argument to open this module directly
     self.launchArg = "--lightdm"
     #Should be none by default. This value is used internally by swami
     self.button = None
     
     self.icon = Icon(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
     self.icon.standard_set('video-display')
     self.icon.show()
     
     self.mainBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     self.mainBox.show()
     
     self.config = {}
     
     with open(LightDMConf) as f:
         for line in f:
             #Sections start with [ - such as [SeatDefaults]
             if line[0] != "[":
                 setting, value = line.replace("\n", "").split("=")
                 
                 e = Entry(self)
                 e.single_line_set(True)
                 e.text = value
                 e.show()
                 
                 f = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
                 f.text = setting
                 f.content = e
                 f.show()
                 
                 self.mainBox.pack_end(f)
                 
                 self.config[setting] = f
     
     buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
     buttonBox.horizontal = True
     
     buttonSave = StandardButton(self, "Save Changes", "ok", self.savePressed)
     buttonSave.show()
     
     buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed)
     buttonReturn.show()
     
     buttonBox.pack_end(buttonSave)
     buttonBox.pack_end(buttonReturn)
     buttonBox.show()
     
     self.pack_end(self.mainBox)
     self.pack_end(buttonBox)
예제 #4
0
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.tabs = []
        self.current = None
        self.tab_changed_cb = None
        self.close_cb = None
        self.empty_cb = None

        self.scr = Scroller(self,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH)
        self.scr.content_min_limit(False, True)

        self.button_bx = Box(self.scr,
                             size_hint_weight=EXPAND_HORIZ,
                             align=ALIGN_LEFT)
        self.button_bx.horizontal = True
        self.button_bx.show()

        self.scr.content = self.button_bx
        self.scr.show()

        self.nav_fr = Naviframe(self,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
        self.nav_fr.show()

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

        self.tabs = []
        self.currentTab = None
        self.tabChangedCallback = None
        self.closeCallback = None
        self.emptyCallback = None

        self.scr = Scroller(self, size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=FILL_BOTH)
        self.scr.content_min_limit(False, True)

        self.buttonBox = Box(self.scr, size_hint_weight=EXPAND_HORIZ,
                           align=ALIGN_LEFT)
        self.buttonBox.horizontal = True
        self.buttonBox.show()

        self.scr.content = self.buttonBox
        self.scr.show()
        
        self.nf = Naviframe(self, size_hint_weight=EXPAND_BOTH,
                               size_hint_align=FILL_BOTH)
        self.nf.show()

        self.pack_end(self.scr)
        self.pack_end(self.nf)
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.ourList = ourList = List(self,
                                      size_hint_weight=EXPAND_BOTH,
                                      size_hint_align=FILL_BOTH)

        self.keys = []

        ourList.go()
        ourList.show()

        self.ourItems = []

        sframe = Frame(self,
                       size_hint_weight=EXPAND_HORIZ,
                       size_hint_align=FILL_HORIZ)
        sframe.text = "Search"
        self.search = search = Entry(self)
        search.single_line = True
        search.callback_changed_add(self.searchChange)
        sframe.content = search
        search.show()
        sframe.show()

        self.pack_end(ourList)
        self.pack_end(sframe)
예제 #8
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)
    def __init__(self, parent_widget, titles=None, initial_sort=None, ascending=True, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.header = titles
        self.sort_column = initial_sort
        self.sort_column_ascending = ascending

        self.rows = []
        self.header_row = []
        self.header_box = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
        self.header_box.horizontal = True
        self.header_box.show()

        scr = Scroller(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

        self.list_box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.list_box.horizontal = True
        self.list_box.show()

        scr.policy_set(ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON)
        scr.content = self.list_box
        scr.show()

        self.lists = []

        self.pack_end(self.header_box)
        self.pack_end(scr)
        self.show()

        if titles is not None:
            self.header_row_pack(titles)
    def __init__(self, parent_widget, titles=None, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.outPut = Entry(self,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.outPut.editable_set(False)
        self.outPut.scrollable_set(True)
        self.outPut.callback_changed_add(self.changedCb)
        self.outPut.show()

        frame = Frame(self,
                      size_hint_weight=EXPAND_HORIZ,
                      size_hint_align=FILL_HORIZ)
        frame.text = "Input:"
        frame.autocollapse_set(True)
        frame.collapse_go(True)
        frame.show()

        bx = Box(self,
                 size_hint_weight=EXPAND_HORIZ,
                 size_hint_align=FILL_HORIZ)
        bx.horizontal = True
        bx.show()

        frame.content = bx

        self.inPut = Entry(self,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.inPut.single_line_set(True)
        self.inPut.callback_activated_add(self.enterPressed)
        self.inPut.show()

        enterButton = Button(self)
        enterButton.text = "Execute"
        enterButton.callback_pressed_add(self.enterPressed)
        enterButton.show()

        bx.pack_end(self.inPut)
        bx.pack_end(enterButton)

        self.pack_end(self.outPut)
        self.pack_end(frame)

        self.cmd_exe = None
        self.done_cb = None
예제 #11
0
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.output = Entry(self,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.output.editable_set(False)
        self.output.scrollable_set(True)
        self.output.callback_changed_add(self.cb_changed)
        self.output.show()

        frame = Frame(self,
                      size_hint_weight=EXPAND_HORIZ,
                      size_hint_align=FILL_HORIZ)
        frame.text = 'Input:'
        frame.autocollapse_set(True)
        frame.collapse_go(True)
        frame.show()

        hbx = Box(self,
                  size_hint_weight=EXPAND_HORIZ,
                  size_hint_align=FILL_HORIZ)
        hbx.horizontal = True
        hbx.show()

        frame.content = hbx

        self.input = Entry(self,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.input.single_line_set(True)
        self.input.callback_activated_add(self.cb_enter)
        self.input.show()

        enter_btn = Button(self)
        enter_btn.text = 'Execute'
        enter_btn.callback_pressed_add(self.cb_enter)
        enter_btn.show()

        hbx.pack_end(self.input)
        hbx.pack_end(enter_btn)

        self.pack_end(self.output)
        self.pack_end(frame)

        self.cmd_exe = None
        self.done_cb = None
예제 #12
0
 def __init__(self, rent):
     Box.__init__(self, rent)
     self.parent = rent
     
     self.name = "Keyboard Layout"
     self.section = "System Settings"
     self.searchData = ["keyboard", "layout", "system", "input"]
     self.launchArg = "--keyboard"
     self.button = None
     
     self.icon = Icon(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
     self.icon.standard_set('input-keyboard')
     self.icon.show()
     
     #print(list(KeyboardLayouts))
     
     self.keyboardList = keyboardList = SearchableList(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     keyboardList.callback_item_focused_add(self.enableKBSelect)
     self.keys = list(KeyboardLayouts)
     self.keys.sort()
     for kbl in self.keys:
         keyboardList.item_append(kbl)
     keyboardList.show()
     
     self.mainBox = Box(self, size_hint_weight = EXPAND_BOTH, size_hint_align = FILL_BOTH)
     self.mainBox.pack_end(keyboardList)
     self.mainBox.show()
     
     buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
     buttonBox.horizontal = True
     
     self.buttonKBSelect = buttonKBSelect = StandardButton(self, "Apply Selected", "ok", self.applyPressed)
     buttonKBSelect.disabled = True
     buttonKBSelect.show()
     
     buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed)
     buttonReturn.show()
     
     buttonBox.pack_end(buttonKBSelect)
     buttonBox.pack_end(buttonReturn)
     buttonBox.show()
     
     self.pack_end(self.mainBox)
     self.pack_end(buttonBox)
    def __init__(self,
                 parent_widget,
                 *args,
                 titles=None,
                 initial_sort=0,
                 ascending=True,
                 **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.header = titles
        self.sort_column = initial_sort
        self.sort_column_ascending = ascending

        self.rows = []
        self.header_row = []
        self.header_box = Box(self,
                              size_hint_weight=EXPAND_HORIZ,
                              size_hint_align=FILL_HORIZ)
        self.header_box.horizontal = True
        self.header_box.show()

        scr = Scroller(self,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)

        self.list_box = Box(self,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.list_box.horizontal = True
        self.list_box.show()

        scr.policy_set(ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON)
        scr.content = self.list_box
        scr.show()

        self.lists = []

        self.pack_end(self.header_box)
        self.pack_end(scr)
        self.show()

        if titles is not None:
            self.header_row_pack(titles)
예제 #14
0
파일: gui.py 프로젝트: mwarchulinski/edone
    def __init__(self, parent):
        self._freezed = False  # used in populate to not trigger callbacks
        Box.__init__(self, parent,
                     size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT)

        # status (view: all, todo or done)
        seg = SegmentControl(self, focus_allow=False)
        for name, val in ('All','all'),('Todo','todo'),('Done','done'):
            it = seg.item_add(None, name)
            it.data['view'] = val
            it.selected = True if options.view == val else False
        seg.callback_changed_add(self._status_changed_cb)
        self.pack_end(seg)
        seg.show()

        # @Projects list
        label = Label(self, text="<b>Projects +</b>", scale=1.4)
        self.pack_end(label)
        label.show()

        self.projs_list = List(self, multi_select=True, focus_allow=False,
                               size_hint_weight=EXPAND_BOTH,
                               size_hint_align=FILL_BOTH)
        self.projs_list.callback_selected_add(self._list_selection_changed_cb)
        self.projs_list.callback_unselected_add(self._list_selection_changed_cb)
        self.pack_end(self.projs_list)
        self.projs_list.show()
        
        # @Contexts list
        label = Label(self, text="<b>Contexts @</b>", scale=1.4)
        self.pack_end(label)
        label.show()

        self.cxts_list = List(self, multi_select=True, focus_allow=False,
                              size_hint_weight=EXPAND_BOTH,
                              size_hint_align=FILL_BOTH)
        self.cxts_list.callback_selected_add(self._list_selection_changed_cb)
        self.cxts_list.callback_unselected_add(self._list_selection_changed_cb)
        self.pack_end(self.cxts_list)
        self.cxts_list.show()

        self.show()
예제 #15
0
파일: tabbedbox.py 프로젝트: mikpim01/lekha
    def __init__(self, parent_widget, add_tab=False, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self._dict = OrderedDict()

        # Tabs
        scr = self._scr = Scroller(
            self,
            size_hint_weight=EXPAND_HORIZ,
            size_hint_align=FILL_BOTH,
            policy=(ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF),
            movement_block=ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)
        scr.content_min_limit(False, True)

        tb = self._tabBox = Box(self._scr,
                                size_hint_weight=EXPAND_HORIZ,
                                align=ALIGN_LEFT,
                                horizontal=True)
        tb.show()

        self._addTab = None
        if add_tab:
            at = self._addTab = Button(self._tabBox, style="anchor")
            at.content = Icon(self._addTab, standard="list-add")
            at.callback_clicked_add(
                lambda x: self.callback_call("tabs,add,clicked"))
            self._tabBox.pack_end(self._addTab)
            at.show()

        scr.content = self._tabBox
        scr.show()

        # Contents
        nf = self._nf = Naviframe(self,
                                  size_hint_weight=EXPAND_BOTH,
                                  size_hint_align=FILL_BOTH)
        nf.callback_transition_finished_add(self._nfit_shown)
        nf.show()

        self.pack_end(scr)
        self.pack_end(nf)
    def __init__(self, parent, low, high, minim, maxim):

        Box.__init__(self, parent)
        self.size_hint_weight = EXPAND_BOTH
        self.size_hint_align = FILL_BOTH
        self.horizontal = True

        l = self.listenlow = Spinner(parent)
        l.size_hint_weight = EXPAND_BOTH
        l.size_hint_align = FILL_BOTH
        l.min_max = minim, maxim
        l.value = low
        self.pack_end(l)
        l.show()

        h = self.listenhigh = Spinner(parent)
        h.size_hint_weight = EXPAND_BOTH
        h.size_hint_align = FILL_BOTH
        h.min_max = minim, maxim
        h.value = high
        self.pack_end(h)
        h.show()
    def __init__(self, parent_widget, titles=None, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.outPut = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.outPut.editable_set(False)
        self.outPut.scrollable_set(True)
        self.outPut.callback_changed_add(self.changedCb)
        self.outPut.show()

        frame = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
        frame.text = "Input:"
        frame.autocollapse_set(True)
        frame.collapse_go(True)
        frame.show()

        bx = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
        bx.horizontal = True
        bx.show()

        frame.content = bx

        self.inPut = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.inPut.single_line_set(True)
        self.inPut.callback_activated_add(self.enterPressed)
        self.inPut.show()

        enterButton = Button(self)
        enterButton.text = "Execute"
        enterButton.callback_pressed_add(self.enterPressed)
        enterButton.show()

        bx.pack_end(self.inPut)
        bx.pack_end(enterButton)

        self.pack_end(self.outPut)
        self.pack_end(frame)

        self.cmd_exe = None
        self.done_cb = None
예제 #18
0
    def __init__(self, parent, low, high, minim, maxim):

        Box.__init__(self, parent)
        self.size_hint_weight = EXPAND_BOTH
        self.size_hint_align = FILL_BOTH
        self.horizontal = True

        l = self.listenlow = Spinner(parent)
        l.size_hint_weight = EXPAND_BOTH
        l.size_hint_align = FILL_BOTH
        l.min_max = minim, maxim
        l.value = low
        self.pack_end(l)
        l.show()

        h = self.listenhigh = Spinner(parent)
        h.size_hint_weight = EXPAND_BOTH
        h.size_hint_align = FILL_BOTH
        h.min_max = minim, maxim
        h.value = high
        self.pack_end(h)
        h.show()
예제 #19
0
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.ourList = ourList = List(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        
        self.keys = []
        
        ourList.go()
        ourList.show()
        
        self.ourItems = []
        
        sframe = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
        sframe.text = "Search"
        self.search = search = Entry(self)
        search.single_line = True
        search.callback_changed_add(self.searchChange)
        sframe.content = search
        search.show()
        sframe.show()
        
        self.pack_end(ourList)
        self.pack_end(sframe)
    def __init__(self, parent, h):
        Box.__init__(self, parent)

        filelist = Genlist(self)
        filelist.size_hint_align = -1.0, -1.0
        filelist.size_hint_weight = 1.0, 1.0

        self.populate(filelist, h)

        filelist.callback_activated_add(self.item_activated_cb)
        filelist.show()

        sel_all = Button(self)
        sel_all.text = "Select all"
        sel_all.callback_clicked_add(self.select_all_cb, filelist, h, True)
        sel_all.show()

        sel_none = Button(self)
        sel_none.text = "Select none"
        sel_none.callback_clicked_add(self.select_all_cb, filelist, h, False)
        sel_none.show()

        xbtn = Button(self)
        xbtn.text = "Close"
        xbtn.callback_clicked_add(lambda x: parent.item_pop())
        xbtn.show()

        btn_box = Box(self)
        btn_box.horizontal = True
        btn_box.pack_end(sel_all)
        btn_box.pack_end(sel_none)
        btn_box.pack_end(xbtn)
        btn_box.show()

        self.pack_end(filelist)
        self.pack_end(btn_box)
        self.show()
예제 #21
0
파일: dagview.py 프로젝트: DaveMDS/egitu
    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()
예제 #22
0
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent

        self.name = "Theme Selector"
        self.section = "Appearance"
        self.searchData = [
            "theme", "gtk", "elementary", "elm", "gnome", "appearance", "look"
        ]
        self.launchArg = "--theme"
        self.button = None

        self.icon = Icon(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.icon.standard_set('preferences-desktop-theme')
        self.icon.show()

        self.foundThemes = []

        self.currentPreview = None
        self.selectedTheme = None

        self.previewBox = previewBox = Scroller(self,
                                                size_hint_weight=EXPAND_BOTH,
                                                size_hint_align=FILL_BOTH)
        previewBox.show()

        self.themeList = List(self,
                              size_hint_weight=(0.35, 1.0),
                              size_hint_align=FILL_BOTH,
                              mode=ELM_LIST_COMPRESS)
        #Adds themes in the ThemePaths to the list for selection
        self.populateThemes()
        self.themeList.go()
        self.themeList.show()

        themeBox = Box(self,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)
        themeBox.horizontal_set(True)
        themeBox.pack_end(self.themeList)
        themeBox.pack_end(self.previewBox)
        themeBox.show()

        self.fs = fs = FileSelector(self,
                                    size_hint_weight=EXPAND_BOTH,
                                    size_hint_align=FILL_BOTH)
        fs.setMode("Open")
        fs.show()

        #need to do this to shutdown threading for the file selector
        self.parent.callback_delete_request_add(self.shutDownFS)

        fs.callback_activated_add(self.fileSelected)

        # Flip object has the file selector on one side
        #   and the GUI on the other
        self.flip = Flip(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", themeBox)
        self.flip.part_content_set("back", self.fs)
        self.flip.show()

        fs.callback_cancel_add(
            lambda o: self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS))

        #self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS)

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

        buttonBox = Box(self,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH)
        buttonBox.horizontal = True

        buttonApply = StandardButton(self, "Apply Selected", "ok",
                                     self.applyPressed)
        buttonApply.show()

        buttonWeb = StandardButton(self, "Get Themes", "applications-internet",
                                   self.webPressed)
        buttonWeb.show()

        #buttonGTK = StandardButton(self, "GTK Theme", "preferences-desktop-gnome", self.gtkPressed)
        #buttonGTK.show()

        #buttonElm = StandardButton(self, "Elementary Theme", "", self.elmPressed)
        #buttonElm.show()

        buttonImport = StandardButton(self, "Import Theme",
                                      "preferences-desktop-theme",
                                      self.importPressed)
        buttonImport.show()

        buttonReturn = StandardButton(self, "Back", "go-previous",
                                      self.returnPressed)
        buttonReturn.show()

        buttonBox.pack_end(buttonApply)
        buttonBox.pack_end(buttonWeb)
        #buttonBox.pack_end(buttonGTK)
        #buttonBox.pack_end(buttonElm)
        buttonBox.pack_end(buttonImport)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()

        self.pack_end(self.mainBox)
        self.pack_end(buttonBox)
예제 #23
0
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent
        
        self.name = "Wallpaper"
        self.section = "Appearance"
        self.searchData = ["wallpaper", "appearance", "look"]
        self.launchArg = "--wallpaper"
        self.button = None
        
        self.icon = Icon(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
        self.icon.standard_set('wallpaper')
        self.icon.show()
        
        self.foundWalls = []
        
        self.currentPreview = None
        self.selectedWall = None
        
        self.flip = Flip(self, size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        
        wallBox = Box(self.flip, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        wallBox.horizontal_set(True)
        
        self.previewBox = previewBox = Scroller(wallBox, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        previewBox.show()
        
        self.wallList = List(self, size_hint_weight=(0.35, 1.0), 
                    size_hint_align=FILL_BOTH, mode=ELM_LIST_COMPRESS)
        #Adds walls in the WallPaths to the list for selection
        self.populateWalls()
        self.wallList.go()
        self.wallList.show()
        
        wallBox.pack_end(self.wallList)
        wallBox.pack_end(self.previewBox)
        wallBox.show()
        
        self.fs = fs = FileSelector(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        fs.setMode("Open")
        fs.show()

        #need to do this to shutdown threading for the file selector
        self.parent.callback_delete_request_add(self.shutDownFS)
        
        fs.callback_activated_add(self.fileSelected)
        
        # Flip object has the file selector on one side
        #   and the GUI on the other
        self.flip.part_content_set("front", wallBox)
        self.flip.part_content_set("back", self.fs)
        self.flip.show()
        
        fs.callback_cancel_add(lambda o: self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS))
        
        #self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS)
        
        self.mainBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.mainBox.pack_end(self.flip)
        self.mainBox.show()
        
        buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
        buttonBox.horizontal = True
        
        buttonApply = StandardButton(self, "Apply Selected", "ok", self.applyPressed)
        buttonApply.show()
        
        buttonImport = StandardButton(self, "Import Wallpaper", "wallpaper", self.importPressed)
        buttonImport.show()
        
        buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed)
        buttonReturn.show()
        
        buttonBox.pack_end(buttonApply)
        #buttonBox.pack_end(buttonWeb)
        buttonBox.pack_end(buttonImport)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()
        
        self.pack_end(self.mainBox)
        self.pack_end(buttonBox)
예제 #24
0
    def __init__(self, parent_widget, defaultPath="", defaultPopulate=True, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.cancelCallback = None
        self.actionCallback = None
        self.directoryChangeCallback = None
        
        self.threadedFunction = ThreadedFunction()
        self._timer = ecore.Timer(0.02, self.populateFile)

        #Watch key presses for ctrl+l to select entry
        parent_widget.elm_event_callback_add(self.eventsCb)

        self.selectedFolder = None
        self.showHidden = False
        self.currentDirectory = None
        self.focusedEntry = None
        self.folderOnly = False
        self.sortReverse = False
        self.addingHidden = False
        self.pendingFiles = deque()
        self.currentSubFolders = []
        self.currentFiles = []

        #Mode should be "save" or "load"
        self.mode = "save"

        self.home = os.path.expanduser("~")
        self.root = "/"

        #Label+Entry for File Name
        self.filenameBox = Box(self, size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
        self.filenameBox.horizontal = True
        self.filenameBox.show()

        fileLabel = Label(self, size_hint_weight=(0.15, EVAS_HINT_EXPAND),
                size_hint_align=FILL_HORIZ)
        fileLabel.text = "Filename:"
        fileLabel.show()

        self.fileEntry = Entry(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_HORIZ)
        self.fileEntry.single_line_set(True)
        self.fileEntry.scrollable_set(True)
        self.fileEntry.callback_changed_user_add(self.fileEntryChanged)
        self.fileEntry.show()

        self.filenameBox.pack_end(fileLabel)
        self.filenameBox.pack_end(self.fileEntry)

        sep = Separator(self, size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
        sep.horizontal_set(True)
        sep.show()

        #Label+Entry for File Path
        self.filepathBox = Box(self, size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
        self.filepathBox.horizontal = True
        self.filepathBox.show()

        fileLabel = Label(self, size_hint_weight=(0.15, EVAS_HINT_EXPAND),
                size_hint_align=FILL_HORIZ)
        fileLabel.text = "Current Folder:"
        fileLabel.show()

        self.filepathEntry = Entry(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_HORIZ)
        self.filepathEntry.single_line_set(True)
        self.filepathEntry.scrollable_set(True)
        self.filepathEntry.callback_changed_user_add(self.fileEntryChanged)
        self.filepathEntry.callback_unfocused_add(self.filepathEditDone)
        self.filepathEntry.callback_activated_add(self.filepathEditDone)
        #Wish this worked. Doesn't seem to do anything
        #self.filepathEntry.input_hint_set(ELM_INPUT_HINT_AUTO_COMPLETE)

        if defaultPath and os.path.isdir(defaultPath):
            startPath = defaultPath
        else:
            startPath = self.home
        self.filepathEntry.show()

        self.filepathBox.pack_end(fileLabel)
        self.filepathBox.pack_end(self.filepathEntry)

        self.autocompleteHover = Hoversel(self, hover_parent=self)
        self.autocompleteHover.callback_selected_add(self.autocompleteSelected)
        #self.autocompleteHover.show()

        self.fileSelectorBox = Panes(self, content_left_size=0.3,
                      size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.fileSelectorBox.show()

        """Bookmarks Box contains:

            - Button - Up Arrow
            - List - Home/Root/GTK bookmarks
            - Box
            -- Button - Add Bookmark
            -- Button - Remove Bookmark"""
        self.bookmarkBox = Box(self, size_hint_weight=(0.3, EVAS_HINT_EXPAND),
                size_hint_align=FILL_BOTH)
        self.bookmarkBox.show()


        upIcon = Icon(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH)
        upIcon.standard_set("go-up")
        upIcon.show()

        self.upButton = Button(self, size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ, content=upIcon)
        self.upButton.text = "Up"
        self.upButton.callback_pressed_add(self.upButtonPressed)
        self.upButton.show()

        self.bookmarksList = List(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH)
        self.bookmarksList.callback_activated_add(self.bookmarkDoubleClicked)
        self.bookmarksList.show()

        self.bookmarkModBox = Box(self, size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
        self.bookmarkModBox.horizontal = True
        self.bookmarkModBox.show()

        con = Icon(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH)
        con.standard_set("add")
        con.show()

        self.addButton = Button(self, size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ, content=con)
        self.addButton.callback_pressed_add(self.addButtonPressed)
        self.addButton.disabled = True
        self.addButton.show()

        con = Icon(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH)
        con.standard_set("remove")
        con.show()

        self.removeButton = Button(self, size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ, content=con)
        self.removeButton.callback_pressed_add(self.removeButtonPressed)
        self.removeButton.disabled = True
        self.removeButton.show()

        self.bookmarkModBox.pack_end(self.addButton)
        self.bookmarkModBox.pack_end(self.removeButton)

        self.bookmarkBox.pack_end(self.upButton)
        self.bookmarkBox.pack_end(self.bookmarksList)
        self.bookmarkBox.pack_end(self.bookmarkModBox)

        #Directory List
        self.fileListBox = Box(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH)
        self.fileListBox.show()
        
        self.fileSortButton = Button(self, size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
        self.fileSortButton.text = u"⬆ Name"
        self.fileSortButton.callback_pressed_add(self.sortData)
        self.fileSortButton.show()
        
        self.fileList = Genlist(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH, homogeneous=True,
                mode=ELM_LIST_COMPRESS)
        self.fileList.callback_activated_add(self.fileDoubleClicked)
        self.fileList.show()
        
        self.previewImage = previewImage = Image(self)
        #previewImage.size_hint_weight = EXPAND_BOTH
        previewImage.size_hint_align = FILL_BOTH
        previewImage.show()
        
        self.fileListBox.pack_end(self.fileSortButton)
        self.fileListBox.pack_end(self.fileList)
        self.fileListBox.pack_end(self.previewImage)

        self.fileSelectorBox.part_content_set("left", self.bookmarkBox)
        self.fileSelectorBox.part_content_set("right", self.fileListBox)

        #Cancel and Save/Open button
        self.buttonBox = Box(self, size_hint_weight=EXPAND_HORIZ,
                size_hint_align=(1.0, 0.5))
        self.buttonBox.horizontal = True
        self.buttonBox.show()

        self.actionIcon = Icon(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH)
        self.actionIcon.standard_set("document-save")
        self.actionIcon.show()

        self.actionButton = Button(self, size_hint_weight=(0.0, 0.0),
                size_hint_align=(1.0, 0.5), content=self.actionIcon)
        self.actionButton.text = "Save  "
        self.actionButton.callback_pressed_add(self.actionButtonPressed)
        self.actionButton.show()

        cancelIcon = Icon(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH)
        cancelIcon.standard_set("exit")
        cancelIcon.show()

        self.cancelButton = Button(self, size_hint_weight=(0.0, 0.0),
                size_hint_align=(1.0, 0.5), content=cancelIcon)
        self.cancelButton.text = "Cancel  "
        self.cancelButton.callback_pressed_add(self.cancelButtonPressed)
        self.cancelButton.show()

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

        self.toggleHiddenButton = Button(self, size_hint_weight=(0.0, 0.0),
                size_hint_align=(1.0, 0.5), content=con)
        self.toggleHiddenButton.text = "Toggle Hidden  "
        self.toggleHiddenButton.callback_pressed_add(self.toggleHiddenButtonPressed)
        self.toggleHiddenButton.show()
        
        con = Icon(self, size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH)
        con.standard_set("folder-new")
        con.show()
        
        self.createFolderButton = Button(self, size_hint_weight=(0.0, 0.0),
                size_hint_align=(1.0, 0.5), content=con)
        self.createFolderButton.text = "Create Folder  "
        self.createFolderButton.callback_pressed_add(self.createFolderButtonPressed)
        self.createFolderButton.show()

        self.buttonBox.pack_end(self.createFolderButton)
        self.buttonBox.pack_end(self.toggleHiddenButton)
        self.buttonBox.pack_end(self.cancelButton)
        self.buttonBox.pack_end(self.actionButton)

        self.pack_end(self.filenameBox)
        self.pack_end(sep)
        self.pack_end(self.filepathBox)
        self.pack_end(self.autocompleteHover)
        self.pack_end(self.fileSelectorBox)
        self.pack_end(self.buttonBox)

        self.populateBookmarks()
        
        self.createPopup = Popup(self)
        self.createPopup.part_text_set("title,text", "Create Folder:")

        self.createEn = en = Entry(self, size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
        en.single_line_set(True)
        en.scrollable_set(True)
        en.show()
        
        self.createPopup.content = en

        bt = Button(self, text="Create")
        bt.callback_clicked_add(self.createFolder)
        self.createPopup.part_content_set("button1", bt)

        bt2 = Button(self, text="Cancel")
        bt2.callback_clicked_add(self.closePopup)
        self.createPopup.part_content_set("button2", bt2)

        if defaultPopulate:
            self.populateFiles(startPath)
예제 #25
0
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.cancelCallback = None
        self.actionCallback = None

        self.__first_run = True
        self.use_theme = False
        self.override_theme_font_size = True
        self.override_font_size = 14
        self.theme_data = None
        self.default_font = 'Sans'
        self.default_font_style = 'Regular'
        self.default_font_size = 14
        self.selected_font = self.default_font
        self.selected_font_style = self.default_font_style
        self.selected_font_size = self.default_font_size
        self.font_style_str = self.get_text_style(self.selected_font,
                                                  self.selected_font_style,
                                                  self.selected_font_size)
        self.preview_text = 'abcdefghijk ABCDEFGHIJK'
        # Font size min and max
        self.fs_min = 8
        self.fs_max = 72

        lb = Label(self,
                   text="<br><hilight><i>Select Font</i></hilight>",
                   size_hint_weight=EXPAND_HORIZ,
                   size_hint_align=FILL_BOTH)
        lb.show()
        self.pack_end(lb)
        sp = Separator(self,
                       horizontal=True,
                       size_hint_weight=EXPAND_HORIZ,
                       size_hint_align=FILL_HORIZ)
        sp.show()
        self.pack_end(sp)
        # A horizontal box to hold our font list and font styles
        fontBox = Box(self,
                      horizontal=True,
                      homogeneous=True,
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
        fontBox.show()
        self.pack_end(fontBox)
        # A vertical box to hold label and list of font families
        vBoxFL = Box(self,
                     size_hint_weight=EXPAND_BOTH,
                     size_hint_align=FILL_BOTH)
        vBoxFL.show()
        fontBox.pack_end(vBoxFL)
        # A vertical box to hold label and list of font styles
        vBoxFS = Box(self,
                     size_hint_weight=EXPAND_BOTH,
                     size_hint_align=FILL_BOTH)
        vBoxFS.show()
        fontBox.pack_end(vBoxFS)
        # Generate our needed font data
        #now =time.time()
        fonts = []
        fonts_raw = self.evas.font_available_list()
        # populate with default font families
        #   see elm_font_available_hash_add Function in EFL
        f_families = ['Sans', 'Serif', 'Monospace']
        f_styles = ['Regular', 'Italic', 'Bold', 'Bold Italic']
        fonts_raw += [i + ':style=' + s for i in f_families for s in f_styles]

        self.fonts_hash = {}
        for font in fonts_raw:
            a = font_properties_get(font)
            # if font name contains a '-' a.name will replace with '\\-'
            #   This needs removed to properly display the name
            fn = a.name.replace('\\', '')
            fonts.append(fn)
            if fn in self.fonts_hash:
                self.fonts_hash.setdefault(fn, []).append(a.styles[0])
            else:
                self.fonts_hash[fn] = [a.styles[0]]

        # Deal with some problematic special cases
        for a, s in self.fonts_hash.items():
            #print(a,s)
            if s:
                if len(s) == 1:
                    s[0] = s[0].rstrip()
                    if s[0] == u'regular':
                        s[0] = u'Regular'
                    if s[0] == u'Medium Italic':
                        self.fonts_hash.setdefault(a,
                                                   []).append(u'Bold Italic')
                    elif s[0] == u'Italic':
                        if a != u'Romande ADF Script Std':
                            self.fonts_hash.setdefault(a,
                                                       []).append(u'Regular')
                            self.fonts_hash.setdefault(a, []).append(u'Bold')
                        self.fonts_hash.setdefault(a,
                                                   []).append(u'Bold Italic')
                    else:
                        self.fonts_hash.setdefault(a, []).append(u'Italic')
                        self.fonts_hash.setdefault(a, []).append(u'Bold')
                        self.fonts_hash.setdefault(a,
                                                   []).append(u'Bold Italic')
                elif len(s) == 2:
                    if any(u'Oblique' in w for w in s):
                        if a not in {
                                u'Baskervald ADF Std Heavy',
                                u'Latin Modern Roman Demi'
                        }:
                            self.fonts_hash.setdefault(a, []).append(u'Bold')
                            self.fonts_hash.setdefault(
                                a, []).append(u'Bold Oblique')
                    elif any(u'Italic' in w for w in s):
                        self.fonts_hash.setdefault(a, []).append(u'Bold')
                        self.fonts_hash.setdefault(a,
                                                   []).append(u'Bold Italic')
                    else:
                        self.fonts_hash.setdefault(a, []).append(u'Italic')
                        self.fonts_hash.setdefault(a,
                                                   []).append(u'Bold Italic')
                elif len(s) == 3 and set(s) == {
                        u'Bold', u'Oblique', u'Medium'
                }:
                    # case GWMonospace
                    self.fonts_hash.setdefault(a, []).append(u'Bold Oblique')
                elif len(s) == 3 and set(s) == {
                        u'Italic', u'Regular', u'Bold'
                }:
                    # Case Eden Mills
                    self.fonts_hash.setdefault(a, []).append(u'Bold Italic')
                elif len(s) < 4:
                    print("may need fixed Font style for %s: %s" % (a, s))
        #print(self.fonts_hash)

        # for some strange reason many fonts are displayed multiple times. The following lines remove
        # all duplicates and then sort them alphabetically.
        # FIXME: Is this still true
        fonts = list(set(fonts))
        fonts.sort(cmp=locale.strcoll)

        # Elm List for holding font options
        self.font_list = List(self,
                              size_hint_align=FILL_BOTH,
                              size_hint_weight=EXPAND_BOTH,
                              mode=ELM_LIST_LIMIT)
        #self.font_list.callback_selected_add(self.__font_demo_name_set)
        for font in fonts:
            self.font_list.item_append(font.replace('\\', ''))
            if font == self.selected_font:
                font_it = self.font_list.last_item_get()
        #print  (time.time()- now)
        self.font_list.go()
        self.font_list.show()

        font_family_label = Label(self)
        font_family_label.text = "<br><b>Font:</b>"
        font_family_label.show()
        vBoxFL.pack_end(font_family_label)
        vBoxFL.pack_end(self.font_list)

        # Elm List for hold font styles
        self.font_style = List(self,
                               size_hint_align=FILL_BOTH,
                               size_hint_weight=EXPAND_BOTH,
                               mode=ELM_LIST_LIMIT)
        #self.font_style.callback_selected_add(self.__font_demo_style_set)

        self.__reset_font_style_list(font_it.text_get())

        self.font_style.go()
        self.font_style.show()

        font_style_label = Label(self)
        font_style_label.text = "<br><b>Style:</b>"
        font_style_label.show()
        vBoxFS.pack_end(font_style_label)
        vBoxFS.pack_end(self.font_style)

        # A table to hold font size Spinner and set theme default Check
        tb = Table(self,
                   homogeneous=True,
                   size_hint_weight=EXPAND_HORIZ,
                   size_hint_align=FILL_HORIZ)
        self.pack_end(tb)
        tb.show()

        # spinner to choose the font size
        self.font_sizer = Spinner(self)
        self.font_sizer.min_max_set(self.fs_min, self.fs_max)
        self.font_sizer.value_set(self.selected_font_size)
        #self.font_sizer.callback_changed_add(self.__font_demo_size_set)
        self.font_sizer.show()
        # Label for Spinner
        font_sizer_label = Label(self)
        font_sizer_label.text = "Font Size:  "
        font_sizer_label.show()

        size_box = Box(self,
                       size_hint_weight=EXPAND_HORIZ,
                       size_hint_align=FILL_HORIZ)
        size_box.horizontal_set(True)
        size_box.pack_end(font_sizer_label)
        size_box.pack_end(self.font_sizer)
        size_box.show()
        tb.pack(size_box, 33, 0, 34, 34)

        self.use_theme_ck = Check(self,
                                  text="Theme Default   ",
                                  size_hint_weight=EXPAND_HORIZ,
                                  size_hint_align=(1, 0.5))
        self.use_theme_ck.callback_changed_add(self.__use_theme_checked)
        self.use_theme_ck.show()
        tb.pack(self.use_theme_ck, 67, 0, 33, 34)

        # Entry to hold sample text
        self.font_demo = Entry(self,
                               single_line=True,
                               editable=False,
                               context_menu_disabled=True,
                               text=self.preview_text,
                               scrollable=True,
                               size_hint_weight=EXPAND_HORIZ,
                               size_hint_align=FILL_HORIZ)
        self.font_demo.show()

        demo_box = Frame(self,
                         size_hint_align=FILL_BOTH,
                         text="Preview:",
                         content=self.font_demo)
        demo_box.show()

        # Fixme: move this shit
        font_it.selected_set(True)
        font_it.show()
        # Ensure focus is on Font List
        self.font_list.focus_set(True)
        self.pack_end(demo_box)

        # cancel and OK buttons
        ok_button = Button(self)
        ok_button.text = "OK"
        ok_button.callback_pressed_add(self.__ok_button_pressed)
        ok_button.show()

        cancel_button = Button(self)
        cancel_button.text = "Cancel"
        cancel_button.callback_pressed_add(self.__cancel_button_pressed)
        cancel_button.show()

        # box for buttons
        button_box = Box(self)
        button_box.horizontal_set(True)
        button_box.show()
        button_box.pack_end(cancel_button)
        button_box.pack_end(ok_button)
        self.pack_end(button_box)
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent
        
        #This appears on the button in the main swmai window
        self.name = "Startup Applications"
        #The section in the main window the button is added to
        self.section = "Applications"
        #Search terms that this module should appear for
        self.searchData = ["startup", "command", "applications", "apps"]
        #Command line argument to open this module directly
        self.launchArg = "--startupapps"
        #Should be none by default. This value is used internally by swami
        self.button = None
        
        self.icon = Icon(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
        self.icon.standard_set('system-run')
        self.icon.show()
        
        self.mainBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.mainBox.show()
        
        buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
        buttonBox.horizontal = True
        
        buttonApply = StandardButton(self, "Apply", "ok", self.applyPressed)
        buttonApply.show()
        
        buttonFlip = StandardButton(self, "Startup Commands", "preferences-system", self.flipPressed)
        buttonFlip.show()
        
        buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed)
        buttonReturn.show()
        
        buttonBox.pack_end(buttonApply)
        buttonBox.pack_end(buttonFlip)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()
        
        startupApplications = []
        
        with open(StartupApplicationsFile) as startupFile:
            for line in startupFile:
                startupApplications.append(line.rstrip())
        
        desktopFiles = []
        
        for ourPath in ApplicationPaths:
            desktopFiles += [os.path.join(dp, f) for dp, dn, filenames in os.walk(ourPath) for f in filenames if os.path.splitext(f)[1] == '.desktop']
        
        self.startupList = startupList = List(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        
        self.applicationsList = applicationsList = SearchableList(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

        startupToAdd = []
        applicationsToAdd = []

        for d in desktopFiles:
            with open(d) as desktopFile:
                fileName = d.split("/")[-1]
                icon = None
                for line in desktopFile:
                    if line[:5] == "Name=":
                        name = line[5:][:-1]
                    
                    if line[:5] == "Icon=":
                        icon = line[5:].strip()
                
                try:
                    iconObj = Icon(self, standard=icon, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
                except:
                    iconObj = Icon(self, standard="preferences-system", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
                    icon = None
                
                if fileName in startupApplications:
                    startupToAdd.append([name, iconObj, fileName, icon])
                else:
                    applicationsToAdd.append([name, iconObj, fileName, icon])
        
        startupToAdd.sort()
        applicationsToAdd.sort()
        
        for s in startupToAdd:
            ourItem = startupList.item_append(s[0], s[1])
            ourItem.data["file"] = s[2]
            ourItem.data["icon"] = s[3]
            #ourItem.append_to(startupList)
            #startupList.item_append(ourItem)
        
        for a in applicationsToAdd:
            ourItem = applicationsList.item_append(a[0], a[1])
            ourItem.data["file"] = a[2]
            ourItem.data["icon"] = a[3]
            #ourItem.append_to(applicationsList.ourList)
            #applicationsList.item_append(a[0], a[1])
        
        startupList.callback_clicked_double_add(self.startupAppRemove)
        applicationsList.callback_clicked_double_add(self.startupAppAdd)
        
        startupList.go()
        startupList.show()
        applicationsList.show()
        
        startupFrame = Frame(self, size_hint_weight = EXPAND_BOTH, size_hint_align=FILL_BOTH)
        startupFrame.text = "Startup Applications"
        startupFrame.content_set(startupList)
        startupFrame.show()
        
        otherFrame = Frame(self, size_hint_weight = EXPAND_BOTH, size_hint_align=FILL_BOTH)
        otherFrame.text = "Other Applications"
        otherFrame.content_set(applicationsList)
        otherFrame.show()
        
        self.mainBox.pack_end(startupFrame)
        self.mainBox.pack_end(otherFrame)
        
        self.backBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.backBox.show()
        
        self.commandsList = commandsList = List(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        
        with open(StartupCommandsFile) as scf:
            for line in scf:
                if line.rstrip()[-3:] == "| \\":
                    commandsList.item_append(line.rstrip()[:-3])
                else:
                    commandsList.item_append(line.rstrip())
                
        commandsList.callback_clicked_right_add(self.commandRightClicked)
        
        commandsList.go()
        commandsList.show()
        
        commandBox = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=(1, 0.5))
        commandBox.horizontal = True
        commandBox.show()
        
        self.newCommandEntry = newCommandEntry = Entry(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
        newCommandEntry.single_line = True
        newCommandEntry.text = "<i>Type command here</i>"
        newCommandEntry.data["default text"] = True
        newCommandEntry.callback_clicked_add(self.entryClicked)
        newCommandEntry.show()
        
        newCommandButton = StandardButton(self, "Add Command", "add", self.newCmdPressed)
        newCommandButton.show()
        
        delCommandButton = StandardButton(self, "Delete Command", "exit", self.delCmdPressed)
        delCommandButton.show()
        
        commandBox.pack_end(newCommandButton)
        commandBox.pack_end(delCommandButton)
        
        newCommandFrame = Frame(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
        newCommandFrame.text = "Add Startup Command:"
        newCommandFrame.content_set(newCommandEntry)
        newCommandFrame.show()
        
        self.backBox.pack_end(commandsList)
        self.backBox.pack_end(newCommandFrame)
        self.backBox.pack_end(commandBox)
        
        self.flip = Flip(self, size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", self.mainBox)
        self.flip.part_content_set("back", self.backBox)
        self.flip.show()
        
        self.pack_end(self.flip)
        self.pack_end(buttonBox)
예제 #27
0
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent
        
        self.name = "Theme Selector"
        self.section = "Appearance"
        self.searchData = ["theme", "gtk", "elementary", "elm", "gnome",
                    "appearance", "look"]
        self.launchArg = "--theme"
        self.button = None
        
        self.icon = Icon(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.icon.standard_set('preferences-desktop-theme')
        self.icon.show()
        
        self.foundThemes = []
        
        self.currentPreview = None
        self.selectedTheme = None
        
        self.previewBox = previewBox = Scroller(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        previewBox.show()
        
        self.themeList = List(self, size_hint_weight=(0.35, 1.0), 
                    size_hint_align=FILL_BOTH, mode=ELM_LIST_COMPRESS)
        #Adds themes in the ThemePaths to the list for selection
        self.populateThemes()
        self.themeList.go()
        self.themeList.show()
        
        themeBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        themeBox.horizontal_set(True)
        themeBox.pack_end(self.themeList)
        themeBox.pack_end(self.previewBox)
        themeBox.show()
        
        self.fs = fs = FileSelector(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        fs.setMode("Open")
        fs.show()

        #need to do this to shutdown threading for the file selector
        self.parent.callback_delete_request_add(self.shutDownFS)
        
        fs.callback_activated_add(self.fileSelected)
        
        # Flip object has the file selector on one side
        #   and the GUI on the other
        self.flip = Flip(self, size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", themeBox)
        self.flip.part_content_set("back", self.fs)
        self.flip.show()
        
        fs.callback_cancel_add(lambda o: self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS))
        
        #self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS)
        
        self.mainBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.mainBox.pack_end(self.flip)
        self.mainBox.show()
        
        buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
        buttonBox.horizontal = True
        
        buttonApply = StandardButton(self, "Apply Selected", "ok", self.applyPressed)
        buttonApply.show()
        
        buttonWeb = StandardButton(self, "Get Themes", "applications-internet", self.webPressed)
        buttonWeb.show()
        
        #buttonGTK = StandardButton(self, "GTK Theme", "preferences-desktop-gnome", self.gtkPressed)
        #buttonGTK.show()
        
        #buttonElm = StandardButton(self, "Elementary Theme", "", self.elmPressed)
        #buttonElm.show()
        
        buttonImport = StandardButton(self, "Import Theme", "preferences-desktop-theme", self.importPressed)
        buttonImport.show()
        
        buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed)
        buttonReturn.show()
        
        buttonBox.pack_end(buttonApply)
        buttonBox.pack_end(buttonWeb)
        #buttonBox.pack_end(buttonGTK)
        #buttonBox.pack_end(buttonElm)
        buttonBox.pack_end(buttonImport)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()
        
        self.pack_end(self.mainBox)
        self.pack_end(buttonBox)
예제 #28
0
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent

        #This appears on the button in the main swmai window
        self.name = "Startup Applications"
        #The section in the main window the button is added to
        self.section = "Applications"
        #Search terms that this module should appear for
        self.searchData = ["startup", "command", "applications", "apps"]
        #Command line argument to open this module directly
        self.launchArg = "--startupapps"
        #Should be none by default. This value is used internally by swami
        self.button = None

        self.icon = Icon(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
        self.icon.standard_set('system-run')
        self.icon.show()

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

        buttonBox = Box(self,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH)
        buttonBox.horizontal = True

        buttonApply = StandardButton(self, "Apply", "ok", self.applyPressed)
        buttonApply.show()

        buttonFlip = StandardButton(self, "Startup Commands",
                                    "preferences-system", self.flipPressed)
        buttonFlip.show()

        buttonReturn = StandardButton(self, "Back", "go-previous",
                                      self.returnPressed)
        buttonReturn.show()

        buttonBox.pack_end(buttonApply)
        buttonBox.pack_end(buttonFlip)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()

        startupApplications = []

        with open(StartupApplicationsFile, "a+") as startupFile:
            for line in startupFile:
                startupApplications.append(line.rstrip())

        desktopFiles = []

        for ourPath in ApplicationPaths:
            desktopFiles += [
                os.path.join(dp, f) for dp, dn, filenames in os.walk(ourPath)
                for f in filenames if os.path.splitext(f)[1] == '.desktop'
            ]

        self.startupList = startupList = List(self,
                                              size_hint_weight=EXPAND_BOTH,
                                              size_hint_align=FILL_BOTH)

        self.applicationsList = applicationsList = SearchableList(
            self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

        startupToAdd = []
        applicationsToAdd = []

        for d in desktopFiles:
            if os.access(d, os.R_OK):
                with open(d) as desktopFile:
                    fileName = d.split("/")[-1]
                    icon = None
                    for line in desktopFile:
                        if line[:5] == "Name=":
                            name = line[5:][:-1]

                        if line[:5] == "Icon=":
                            icon = line[5:].strip()

                    try:
                        iconObj = Icon(self,
                                       standard=icon,
                                       size_hint_weight=EXPAND_BOTH,
                                       size_hint_align=FILL_BOTH)
                    except:
                        iconObj = Icon(self,
                                       standard="preferences-system",
                                       size_hint_weight=EXPAND_BOTH,
                                       size_hint_align=FILL_BOTH)
                        icon = None

                    if fileName in startupApplications:
                        startupToAdd.append([name, iconObj, fileName, icon])
                    else:
                        applicationsToAdd.append(
                            [name, iconObj, fileName, icon])
            else:
                # Broken link or file problem, inform user
                print "Swami IOError: [Errno 2] No such file or directory: {0}".format(
                    d)

        startupToAdd.sort()
        applicationsToAdd.sort()

        for s in startupToAdd:
            ourItem = startupList.item_append(s[0], s[1])
            ourItem.data["file"] = s[2]
            ourItem.data["icon"] = s[3]
            #ourItem.append_to(startupList)
            #startupList.item_append(ourItem)

        for a in applicationsToAdd:
            ourItem = applicationsList.item_append(a[0], a[1])
            ourItem.data["file"] = a[2]
            ourItem.data["icon"] = a[3]
            #ourItem.append_to(applicationsList.ourList)
            #applicationsList.item_append(a[0], a[1])

        startupList.callback_clicked_double_add(self.startupAppRemove)
        applicationsList.callback_clicked_double_add(self.startupAppAdd)

        startupList.go()
        startupList.show()
        applicationsList.show()

        startupFrame = Frame(self,
                             size_hint_weight=EXPAND_BOTH,
                             size_hint_align=FILL_BOTH)
        startupFrame.text = "Startup Applications"
        startupFrame.content_set(startupList)
        startupFrame.show()

        otherFrame = Frame(self,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        otherFrame.text = "Other Applications"
        otherFrame.content_set(applicationsList)
        otherFrame.show()

        self.mainBox.pack_end(startupFrame)
        self.mainBox.pack_end(otherFrame)

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

        self.commandsList = commandsList = List(self,
                                                size_hint_weight=EXPAND_BOTH,
                                                size_hint_align=FILL_BOTH)

        with open(StartupCommandsFile, "a+") as scf:
            for line in scf:
                if line.rstrip()[-3:] == "| \\":
                    commandsList.item_append(line.rstrip()[:-3])
                else:
                    commandsList.item_append(line.rstrip())

        commandsList.callback_clicked_right_add(self.commandRightClicked)

        commandsList.go()
        commandsList.show()

        commandBox = Box(self,
                         size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=(1, 0.5))
        commandBox.horizontal = True
        commandBox.show()

        self.newCommandEntry = newCommandEntry = Entry(
            self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
        newCommandEntry.single_line = True
        newCommandEntry.text = "<i>Type command here</i>"
        newCommandEntry.data["default text"] = True
        newCommandEntry.callback_clicked_add(self.entryClicked)
        newCommandEntry.show()

        newCommandButton = StandardButton(self, "Add Command", "add",
                                          self.newCmdPressed)
        newCommandButton.show()

        delCommandButton = StandardButton(self, "Delete Command", "exit",
                                          self.delCmdPressed)
        delCommandButton.show()

        commandBox.pack_end(newCommandButton)
        commandBox.pack_end(delCommandButton)

        newCommandFrame = Frame(self,
                                size_hint_weight=EXPAND_HORIZ,
                                size_hint_align=FILL_BOTH)
        newCommandFrame.text = "Add Startup Command:"
        newCommandFrame.content_set(newCommandEntry)
        newCommandFrame.show()

        self.backBox.pack_end(commandsList)
        self.backBox.pack_end(newCommandFrame)
        self.backBox.pack_end(commandBox)

        self.flip = Flip(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", self.mainBox)
        self.flip.part_content_set("back", self.backBox)
        self.flip.show()

        self.pack_end(self.flip)
        self.pack_end(buttonBox)
    def __init__(self,
                 parent_widget,
                 *args,
                 default_path='',
                 default_populate=True,
                 **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.cancel_cb = None
        self.action_cb = None
        self.cb_dir_change = None

        self.threaded_fn = ThreadedFunction()
        # pylint: disable=c-extension-no-member
        self._timer = ecore.Timer(0.02, self.populate_file)

        # Watch key presses for ctrl+l to select entry
        parent_widget.elm_event_callback_add(self.cb_events)

        self.selected_dir = None
        self.show_hidden = False
        self.cur_dir = None
        self.focused_entry = None
        self.dir_only = False
        self.sort_reverse = False
        self.adding_hidden = False
        self.pending_files = deque()
        self.cur_subdirs = []
        self.cur_files = []

        # Mode should be 'save' or 'load'
        self.mode = 'save'

        self.home = os.path.expanduser('~')

        desktop = os.environ.get('XDG_DESKTOP_DIR')
        if desktop:
            self.desktop = desktop
        else:
            self.desktop = self.home + '/Desktop'

        self.root = '/'

        # Label+Entry for File Name
        self.filename_bx = Box(self,
                               size_hint_weight=EXPAND_HORIZ,
                               size_hint_align=FILL_HORIZ)
        self.filename_bx.horizontal = True
        self.filename_bx.show()

        file_label = Label(self,
                           size_hint_weight=(0.15, EVAS_HINT_EXPAND),
                           size_hint_align=FILL_HORIZ)
        file_label.text = 'Filename:'
        file_label.show()

        self.file_entry = Entry(self,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_HORIZ)
        self.file_entry.single_line_set(True)
        self.file_entry.scrollable_set(True)
        self.file_entry.callback_changed_user_add(self.cb_file_entry)
        self.file_entry.show()

        self.filename_bx.pack_end(file_label)
        self.filename_bx.pack_end(self.file_entry)

        sep = Separator(self,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_HORIZ)
        sep.horizontal_set(True)
        sep.show()

        # Label+Entry for File Path
        self.filepath_bx = Box(self,
                               size_hint_weight=EXPAND_HORIZ,
                               size_hint_align=FILL_HORIZ)
        self.filepath_bx.horizontal = True
        self.filepath_bx.show()

        file_label = Label(self,
                           size_hint_weight=(0.15, EVAS_HINT_EXPAND),
                           size_hint_align=FILL_HORIZ)
        file_label.text = 'Current Folder:'
        file_label.show()

        self.filepath_en = Entry(self,
                                 size_hint_weight=EXPAND_BOTH,
                                 size_hint_align=FILL_HORIZ)
        self.filepath_en.single_line_set(True)
        self.filepath_en.scrollable_set(True)
        self.filepath_en.callback_changed_user_add(self.cb_file_entry)
        self.filepath_en.callback_unfocused_add(self.cb_filepath_en)
        self.filepath_en.callback_activated_add(self.cb_filepath_en)
        # Wish this worked. Doesn't seem to do anything
        # Working now EFL 1.22 ?
        self.filepath_en.input_hint_set(ELM_INPUT_HINT_AUTO_COMPLETE)

        if default_path and os.path.isdir(default_path):
            start = default_path
        else:
            start = self.home
        self.filepath_en.show()

        self.filepath_bx.pack_end(file_label)
        self.filepath_bx.pack_end(self.filepath_en)

        self.autocomplete_hover = Hoversel(self, hover_parent=self)
        self.autocomplete_hover.callback_selected_add(self.cb_hover)
        self.autocomplete_hover.show()

        self.file_selector_bx = Panes(self,
                                      content_left_size=0.3,
                                      size_hint_weight=EXPAND_BOTH,
                                      size_hint_align=FILL_BOTH)
        self.file_selector_bx.show()
        # Bookmarks Box contains:
        #
        # - Button - Up Arrow
        # - List - Home/Desktop/Root/GTK bookmarks
        # - Box
        # -- Button - Add Bookmark
        # -- Button - Remove Bookmark
        self.bookmark_bx = Box(self,
                               size_hint_weight=(0.3, EVAS_HINT_EXPAND),
                               size_hint_align=FILL_BOTH)
        self.bookmark_bx.show()

        up_ic = Icon(self,
                     size_hint_weight=EXPAND_BOTH,
                     size_hint_align=FILL_BOTH,
                     order_lookup=ELM_ICON_LOOKUP_THEME)
        up_ic.standard_set('arrow-up')
        up_ic.show()

        self.up_btn = Button(self,
                             size_hint_weight=EXPAND_HORIZ,
                             size_hint_align=FILL_HORIZ,
                             content=up_ic)
        self.up_btn.text = 'Up'
        self.up_btn.callback_pressed_add(self.cb_up_btn)
        self.up_btn.show()

        self.bookmarks_lst = List(self,
                                  size_hint_weight=EXPAND_BOTH,
                                  size_hint_align=FILL_BOTH)
        self.bookmarks_lst.callback_activated_add(self.cb_bookmarks_lst)
        self.bookmarks_lst.show()

        self.bookmark_modbox = Box(self,
                                   size_hint_weight=EXPAND_HORIZ,
                                   size_hint_align=FILL_HORIZ)
        self.bookmark_modbox.horizontal = True
        self.bookmark_modbox.show()

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

        self.add_btn = Button(self,
                              size_hint_weight=EXPAND_HORIZ,
                              size_hint_align=FILL_HORIZ,
                              content=con)
        self.add_btn.callback_pressed_add(self.cb_add_btn)
        self.add_btn.disabled = True
        self.add_btn.show()

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

        self.rm_btn = Button(self,
                             size_hint_weight=EXPAND_HORIZ,
                             size_hint_align=FILL_HORIZ,
                             content=con)
        self.rm_btn.callback_pressed_add(self.cb_remove)
        self.rm_btn.disabled = True
        self.rm_btn.show()

        self.bookmark_modbox.pack_end(self.add_btn)
        self.bookmark_modbox.pack_end(self.rm_btn)

        self.bookmark_bx.pack_end(self.up_btn)
        self.bookmark_bx.pack_end(self.bookmarks_lst)
        self.bookmark_bx.pack_end(self.bookmark_modbox)

        # Directory List
        self.file_list_bx = Box(self,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
        self.file_list_bx.show()

        self.file_sort_btn = Button(self,
                                    size_hint_weight=EXPAND_HORIZ,
                                    size_hint_align=FILL_HORIZ)
        self.file_sort_btn.text = u'⬆ Name'
        self.file_sort_btn.callback_pressed_add(self.cb_sort)
        self.file_sort_btn.show()

        self.file_lst = Genlist(self,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH,
                                homogeneous=True,
                                mode=ELM_LIST_COMPRESS)
        self.file_lst.callback_activated_add(self.cb_file_lst)
        self.file_lst.show()

        self.preview = preview = Image(self)
        preview.size_hint_align = FILL_BOTH
        preview.show()

        self.file_list_bx.pack_end(self.file_sort_btn)
        self.file_list_bx.pack_end(self.file_lst)
        self.file_list_bx.pack_end(self.preview)

        self.file_selector_bx.part_content_set('left', self.bookmark_bx)
        self.file_selector_bx.part_content_set('right', self.file_list_bx)

        # Cancel and Save/Open button
        self.button_bx = Box(self,
                             size_hint_weight=EXPAND_HORIZ,
                             size_hint_align=(1.0, 0.5))
        self.button_bx.horizontal = True
        self.button_bx.show()

        self.action_ic = Icon(self,
                              size_hint_weight=EXPAND_BOTH,
                              size_hint_align=FILL_BOTH)
        self.action_ic.standard_set('document-save')
        self.action_ic.show()

        self.action_btn = Button(self,
                                 size_hint_weight=(0.0, 0.0),
                                 size_hint_align=(1.0, 0.5),
                                 content=self.action_ic)
        self.action_btn.text = 'Save  '
        self.action_btn.callback_pressed_add(self.cb_action_btn)
        self.action_btn.show()

        cancel_ic = Icon(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        cancel_ic.standard_set('application-exit')
        cancel_ic.show()

        self.cancel_btn = Button(self,
                                 size_hint_weight=(0.0, 0.0),
                                 size_hint_align=(1.0, 0.5),
                                 content=cancel_ic)
        self.cancel_btn.text = 'Cancel  '
        self.cancel_btn.callback_pressed_add(self.cb_cancel_btn)
        self.cancel_btn.show()

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

        self.hidden_btn = Button(self,
                                 size_hint_weight=(0.0, 0.0),
                                 size_hint_align=(1.0, 0.5),
                                 content=con)
        self.hidden_btn.text = 'Toggle Hidden  '
        self.hidden_btn.callback_pressed_add(self.cb_toggle_hidden)
        self.hidden_btn.show()

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

        self.create_dir_btn = Button(self,
                                     size_hint_weight=(0.0, 0.0),
                                     size_hint_align=(1.0, 0.5),
                                     content=con)
        self.create_dir_btn.text = 'Create Folder  '
        self.create_dir_btn.callback_pressed_add(self.cb_create_dir)
        self.create_dir_btn.show()

        self.button_bx.pack_end(self.create_dir_btn)
        self.button_bx.pack_end(self.hidden_btn)
        self.button_bx.pack_end(self.cancel_btn)
        self.button_bx.pack_end(self.action_btn)

        self.pack_end(self.filename_bx)
        self.pack_end(sep)
        self.pack_end(self.filepath_bx)
        self.pack_end(self.autocomplete_hover)
        self.pack_end(self.file_selector_bx)
        self.pack_end(self.button_bx)

        self.populate_bookmarks()

        self.create_popup = Popup(self)
        self.create_popup.part_text_set('title,text', 'Create Folder:')

        self.create_en = Entry(self,
                               size_hint_weight=EXPAND_HORIZ,
                               size_hint_align=FILL_HORIZ)
        self.create_en.single_line_set(True)
        self.create_en.scrollable_set(True)
        self.create_en.show()

        self.create_popup.content = self.create_en

        bt0 = Button(self, text='Create')
        bt0.callback_clicked_add(self.cb_create_folder)
        self.create_popup.part_content_set('button1', bt0)
        bt1 = Button(self, text='Cancel')
        bt1.callback_clicked_add(self.cb_close_popup)
        self.create_popup.part_content_set('button2', bt1)

        self.recent = None  # keeps pylint happy:
        if default_populate:
            self.populate_files(start)
예제 #30
0
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent
        
        self.name = "Date and Time"
        self.section = "System Settings"
        self.searchData = ["clock", "timezone", "date", "system"]
        self.launchArg = "--time"
        self.button = None
        
        self.timezones = getTimeZones()
        
        self.icon = Icon(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
        self.icon.standard_set('clock')
        self.icon.show()
        
        cframe = Frame(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        cframe.text = "Current Time"
        cframe.show()

        self.clock = clock = Clock(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        clock.show_seconds_set(True)
        clock.show_am_pm_set(True)
        clock.show()
        
        cframe.content = clock
        
        dframe = Frame(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        dframe.text = "Current Day"
        dframe.show()

        self.cal = cal = Calendar(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        cal.select_mode = ELM_CALENDAR_SELECT_MODE_NONE
        cal.show()
        
        dframe.content = cal
        
        tzframe = Frame(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        tzframe.text = "Current Timezone"
        tzframe.show()

        self.tz = tz = Label(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        tz.text = "<b>%s</b>"%time.tzname[0]
        tz.show()
        
        tzframe.content = tz
        
        self.mainBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.mainBox.pack_end(cframe)
        self.mainBox.pack_end(dframe)
        self.mainBox.pack_end(tzframe)
        self.mainBox.show()
        
        self.zoneList = zoneList = SearchableList(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        zoneList.callback_item_focused_add(self.enableTZSelect)
        self.zones = []
        for tz in self.timezones:
            for each in self.timezones[tz]:
                if each not in self.zones:
                    self.zones.append(each)
        self.zones.sort(reverse=True)
        for zone in self.zones:
            zoneList.item_append(zone)
        zoneList.show()
        
        self.buttonTZSelect = buttonTZSelect = StandardButton(self, "Select", "ok", self.tzselectPressed)
        buttonTZSelect.disabled = True
        buttonTZSelect.show()
        
        buttonTZCancel = StandardButton(self, "Cancel", "close", self.tzcancelPressed)
        buttonTZCancel.show()
        
        tzBBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
        tzBBox.horizontal = True
        tzBBox.pack_end(buttonTZSelect)
        tzBBox.pack_end(buttonTZCancel)
        tzBBox.show()

        tzChangeBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        tzChangeBox.pack_end(zoneList)
        tzChangeBox.pack_end(tzBBox)
        tzChangeBox.show()
        
        self.flip = Flip(self, size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", self.mainBox)
        self.flip.part_content_set("back", tzChangeBox)
        self.flip.show()
        
        buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
        buttonBox.horizontal = True
        
        self.buttonApply = buttonApply = StandardButton(self, "Apply Changes", "ok", self.applyPressed)
        buttonApply.disabled = True
        buttonApply.show()
        
        self.buttonSync = buttonSync = StandardButton(self, "Sync from Internet", "refresh", self.syncPressed)
        buttonSync.show()
        
        self.buttonDT = buttonDT = StandardButton(self, "Edit Date and Time", "x-office-calendar", self.editDTPressed)
        buttonDT.show()
        
        self.buttonTZ = buttonTZ = StandardButton(self, "Change Timezone", "clock", self.editTZPressed)
        buttonTZ.show()
        
        buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed)
        buttonReturn.show()
        
        buttonBox.pack_end(buttonApply)
        buttonBox.pack_end(buttonSync)
        buttonBox.pack_end(buttonDT)
        buttonBox.pack_end(buttonTZ)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()
        
        self.pack_end(self.flip)
        self.pack_end(buttonBox)
예제 #31
0
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent

        self.name = "Wallpaper"
        self.section = "Appearance"
        self.searchData = ["wallpaper", "appearance", "look"]
        self.launchArg = "--wallpaper"
        self.button = None

        self.icon = Icon(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
        self.icon.standard_set('wallpaper')
        self.icon.show()

        self.foundWalls = []

        self.currentPreview = None
        self.selectedWall = None

        self.flip = Flip(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)

        wallBox = Box(self.flip,
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
        wallBox.horizontal_set(True)

        self.previewBox = previewBox = Scroller(wallBox,
                                                size_hint_weight=EXPAND_BOTH,
                                                size_hint_align=FILL_BOTH)
        previewBox.show()

        self.wallList = List(self,
                             size_hint_weight=(0.35, 1.0),
                             size_hint_align=FILL_BOTH,
                             mode=ELM_LIST_COMPRESS)
        #Adds walls in the WallPaths to the list for selection
        self.populateWalls()
        self.wallList.go()
        self.wallList.show()

        wallBox.pack_end(self.wallList)
        wallBox.pack_end(self.previewBox)
        wallBox.show()

        self.fs = fs = FileSelector(self,
                                    size_hint_weight=EXPAND_BOTH,
                                    size_hint_align=FILL_BOTH)
        fs.setMode("Open")
        fs.show()

        #need to do this to shutdown threading for the file selector
        self.parent.callback_delete_request_add(self.shutDownFS)

        fs.callback_activated_add(self.fileSelected)

        # Flip object has the file selector on one side
        #   and the GUI on the other
        self.flip.part_content_set("front", wallBox)
        self.flip.part_content_set("back", self.fs)
        self.flip.show()

        fs.callback_cancel_add(
            lambda o: self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS))

        #self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS)

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

        buttonBox = Box(self,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH)
        buttonBox.horizontal = True

        buttonApply = StandardButton(self, "Apply Selected", "ok",
                                     self.applyPressed)
        buttonApply.show()

        buttonImport = StandardButton(self, "Import Wallpaper", "wallpaper",
                                      self.importPressed)
        buttonImport.show()

        buttonReturn = StandardButton(self, "Back", "go-previous",
                                      self.returnPressed)
        buttonReturn.show()

        buttonBox.pack_end(buttonApply)
        #buttonBox.pack_end(buttonWeb)
        buttonBox.pack_end(buttonImport)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()

        self.pack_end(self.mainBox)
        self.pack_end(buttonBox)
    def __init__(self,
                 parent_widget,
                 defaultPath="",
                 defaultPopulate=True,
                 *args,
                 **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.cancelCallback = None
        self.actionCallback = None
        self.directoryChangeCallback = None

        self.threadedFunction = ThreadedFunction()
        self._timer = ecore.Timer(0.02, self.populateFile)

        #Watch key presses for ctrl+l to select entry
        parent_widget.elm_event_callback_add(self.eventsCb)

        self.selectedFolder = None
        self.showHidden = False
        self.currentDirectory = None
        self.focusedEntry = None
        self.folderOnly = False
        self.sortReverse = False
        self.addingHidden = False
        self.pendingFiles = deque()
        self.currentSubFolders = []
        self.currentFiles = []

        #Mode should be "save" or "load"
        self.mode = "save"

        self.home = os.path.expanduser("~")
        self.root = "/"

        #Label+Entry for File Name
        self.filenameBox = Box(self,
                               size_hint_weight=EXPAND_HORIZ,
                               size_hint_align=FILL_HORIZ)
        self.filenameBox.horizontal = True
        self.filenameBox.show()

        fileLabel = Label(self,
                          size_hint_weight=(0.15, EVAS_HINT_EXPAND),
                          size_hint_align=FILL_HORIZ)
        fileLabel.text = "Filename:"
        fileLabel.show()

        self.fileEntry = Entry(self,
                               size_hint_weight=EXPAND_BOTH,
                               size_hint_align=FILL_HORIZ)
        self.fileEntry.single_line_set(True)
        self.fileEntry.scrollable_set(True)
        self.fileEntry.callback_changed_user_add(self.fileEntryChanged)
        self.fileEntry.show()

        self.filenameBox.pack_end(fileLabel)
        self.filenameBox.pack_end(self.fileEntry)

        sep = Separator(self,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_HORIZ)
        sep.horizontal_set(True)
        sep.show()

        #Label+Entry for File Path
        self.filepathBox = Box(self,
                               size_hint_weight=EXPAND_HORIZ,
                               size_hint_align=FILL_HORIZ)
        self.filepathBox.horizontal = True
        self.filepathBox.show()

        fileLabel = Label(self,
                          size_hint_weight=(0.15, EVAS_HINT_EXPAND),
                          size_hint_align=FILL_HORIZ)
        fileLabel.text = "Current Folder:"
        fileLabel.show()

        self.filepathEntry = Entry(self,
                                   size_hint_weight=EXPAND_BOTH,
                                   size_hint_align=FILL_HORIZ)
        self.filepathEntry.single_line_set(True)
        self.filepathEntry.scrollable_set(True)
        self.filepathEntry.callback_changed_user_add(self.fileEntryChanged)
        self.filepathEntry.callback_unfocused_add(self.filepathEditDone)
        self.filepathEntry.callback_activated_add(self.filepathEditDone)
        #Wish this worked. Doesn't seem to do anything
        #self.filepathEntry.input_hint_set(ELM_INPUT_HINT_AUTO_COMPLETE)

        if defaultPath and os.path.isdir(defaultPath):
            startPath = defaultPath
        else:
            startPath = self.home
        self.filepathEntry.show()

        self.filepathBox.pack_end(fileLabel)
        self.filepathBox.pack_end(self.filepathEntry)

        self.autocompleteHover = Hoversel(self, hover_parent=self)
        self.autocompleteHover.callback_selected_add(self.autocompleteSelected)
        #self.autocompleteHover.show()

        self.fileSelectorBox = Panes(self,
                                     content_left_size=0.3,
                                     size_hint_weight=EXPAND_BOTH,
                                     size_hint_align=FILL_BOTH)
        self.fileSelectorBox.show()
        """Bookmarks Box contains:

            - Button - Up Arrow
            - List - Home/Root/GTK bookmarks
            - Box
            -- Button - Add Bookmark
            -- Button - Remove Bookmark"""
        self.bookmarkBox = Box(self,
                               size_hint_weight=(0.3, EVAS_HINT_EXPAND),
                               size_hint_align=FILL_BOTH)
        self.bookmarkBox.show()

        upIcon = Icon(self,
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
        upIcon.standard_set("go-up")
        upIcon.show()

        self.upButton = Button(self,
                               size_hint_weight=EXPAND_HORIZ,
                               size_hint_align=FILL_HORIZ,
                               content=upIcon)
        self.upButton.text = "Up"
        self.upButton.callback_pressed_add(self.upButtonPressed)
        self.upButton.show()

        self.bookmarksList = List(self,
                                  size_hint_weight=EXPAND_BOTH,
                                  size_hint_align=FILL_BOTH)
        self.bookmarksList.callback_activated_add(self.bookmarkDoubleClicked)
        self.bookmarksList.show()

        self.bookmarkModBox = Box(self,
                                  size_hint_weight=EXPAND_HORIZ,
                                  size_hint_align=FILL_HORIZ)
        self.bookmarkModBox.horizontal = True
        self.bookmarkModBox.show()

        con = Icon(self,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        con.standard_set("add")
        con.show()

        self.addButton = Button(self,
                                size_hint_weight=EXPAND_HORIZ,
                                size_hint_align=FILL_HORIZ,
                                content=con)
        self.addButton.callback_pressed_add(self.addButtonPressed)
        self.addButton.disabled = True
        self.addButton.show()

        con = Icon(self,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        con.standard_set("remove")
        con.show()

        self.removeButton = Button(self,
                                   size_hint_weight=EXPAND_HORIZ,
                                   size_hint_align=FILL_HORIZ,
                                   content=con)
        self.removeButton.callback_pressed_add(self.removeButtonPressed)
        self.removeButton.disabled = True
        self.removeButton.show()

        self.bookmarkModBox.pack_end(self.addButton)
        self.bookmarkModBox.pack_end(self.removeButton)

        self.bookmarkBox.pack_end(self.upButton)
        self.bookmarkBox.pack_end(self.bookmarksList)
        self.bookmarkBox.pack_end(self.bookmarkModBox)

        #Directory List
        self.fileListBox = Box(self,
                               size_hint_weight=EXPAND_BOTH,
                               size_hint_align=FILL_BOTH)
        self.fileListBox.show()

        self.fileSortButton = Button(self,
                                     size_hint_weight=EXPAND_HORIZ,
                                     size_hint_align=FILL_HORIZ)
        self.fileSortButton.text = u"⬆ Name"
        self.fileSortButton.callback_pressed_add(self.sortData)
        self.fileSortButton.show()

        self.fileList = Genlist(self,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH,
                                homogeneous=True,
                                mode=ELM_LIST_COMPRESS)
        self.fileList.callback_activated_add(self.fileDoubleClicked)
        self.fileList.show()

        self.previewImage = previewImage = Image(self)
        #previewImage.size_hint_weight = EXPAND_BOTH
        previewImage.size_hint_align = FILL_BOTH
        previewImage.show()

        self.fileListBox.pack_end(self.fileSortButton)
        self.fileListBox.pack_end(self.fileList)
        self.fileListBox.pack_end(self.previewImage)

        self.fileSelectorBox.part_content_set("left", self.bookmarkBox)
        self.fileSelectorBox.part_content_set("right", self.fileListBox)

        #Cancel and Save/Open button
        self.buttonBox = Box(self,
                             size_hint_weight=EXPAND_HORIZ,
                             size_hint_align=(1.0, 0.5))
        self.buttonBox.horizontal = True
        self.buttonBox.show()

        self.actionIcon = Icon(self,
                               size_hint_weight=EXPAND_BOTH,
                               size_hint_align=FILL_BOTH)
        self.actionIcon.standard_set("document-save")
        self.actionIcon.show()

        self.actionButton = Button(self,
                                   size_hint_weight=(0.0, 0.0),
                                   size_hint_align=(1.0, 0.5),
                                   content=self.actionIcon)
        self.actionButton.text = "Save  "
        self.actionButton.callback_pressed_add(self.actionButtonPressed)
        self.actionButton.show()

        cancelIcon = Icon(self,
                          size_hint_weight=EXPAND_BOTH,
                          size_hint_align=FILL_BOTH)
        cancelIcon.standard_set("dialog-cancel")
        cancelIcon.show()

        self.cancelButton = Button(self,
                                   size_hint_weight=(0.0, 0.0),
                                   size_hint_align=(1.0, 0.5),
                                   content=cancelIcon)
        self.cancelButton.text = "Cancel  "
        self.cancelButton.callback_pressed_add(self.cancelButtonPressed)
        self.cancelButton.show()

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

        self.toggleHiddenButton = Button(self,
                                         size_hint_weight=(0.0, 0.0),
                                         size_hint_align=(1.0, 0.5),
                                         content=con)
        self.toggleHiddenButton.text = "Toggle Hidden  "
        self.toggleHiddenButton.callback_pressed_add(
            self.toggleHiddenButtonPressed)
        self.toggleHiddenButton.show()

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

        self.createFolderButton = Button(self,
                                         size_hint_weight=(0.0, 0.0),
                                         size_hint_align=(1.0, 0.5),
                                         content=con)
        self.createFolderButton.text = "Create Folder  "
        self.createFolderButton.callback_pressed_add(
            self.createFolderButtonPressed)
        self.createFolderButton.show()

        self.buttonBox.pack_end(self.createFolderButton)
        self.buttonBox.pack_end(self.toggleHiddenButton)
        self.buttonBox.pack_end(self.cancelButton)
        self.buttonBox.pack_end(self.actionButton)

        self.pack_end(self.filenameBox)
        self.pack_end(sep)
        self.pack_end(self.filepathBox)
        self.pack_end(self.autocompleteHover)
        self.pack_end(self.fileSelectorBox)
        self.pack_end(self.buttonBox)

        self.populateBookmarks()

        self.createPopup = Popup(self)
        self.createPopup.part_text_set("title,text", "Create Folder:")

        self.createEn = en = Entry(self,
                                   size_hint_weight=EXPAND_HORIZ,
                                   size_hint_align=FILL_HORIZ)
        en.single_line_set(True)
        en.scrollable_set(True)
        en.show()

        self.createPopup.content = en

        bt = Button(self, text="Create")
        bt.callback_clicked_add(self.createFolder)
        self.createPopup.part_content_set("button1", bt)

        bt2 = Button(self, text="Cancel")
        bt2.callback_clicked_add(self.closePopup)
        self.createPopup.part_content_set("button2", bt2)

        if defaultPopulate:
            self.populateFiles(startPath)
예제 #33
0
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent

        #This appears on the button in the main swmai window
        self.name = "Light DM"
        #The section in the main window the button is added to
        self.section = "System Settings"
        #Search terms that this module should appear for
        self.searchData = ["lightdm", "autologin", "login", "display"]
        #Command line argument to open this module directly
        self.launchArg = "--lightdm"
        #Should be none by default. This value is used internally by swami
        self.button = None

        self.icon = Icon(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
        self.icon.standard_set('video-display')
        self.icon.show()

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

        self.config = {"sections": []}

        with open(LightDMConf) as f:
            currentSection = None
            for line in f:
                #Sections start with [ - such as [SeatDefaults]
                if line[0] == "[":
                    self.config["sections"].append(line)
                    currentSection = line.rstrip()
                    s = Frame(self,
                              size_hint_weight=EXPAND_HORIZ,
                              size_hint_align=FILL_HORIZ)
                    s.text = currentSection[1:-1]
                    s.show()

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

                    s.content = sectionBox

                    self.mainBox.pack_end(s)
                elif line[0] not in ["[", "\n"]:
                    setting, value = line.replace("\n", "").split("=")

                    e = Entry(self)
                    e.single_line_set(True)
                    e.text = value
                    e.show()

                    f = Frame(self,
                              size_hint_weight=EXPAND_HORIZ,
                              size_hint_align=FILL_HORIZ)
                    f.text = setting
                    f.content = e
                    f.show()

                    sectionBox.pack_end(f)

                    self.config[setting] = [f, currentSection]

        buttonBox = Box(self,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH)
        buttonBox.horizontal = True

        buttonSave = StandardButton(self, "Save Changes", "ok",
                                    self.savePressed)
        buttonSave.show()

        buttonReturn = StandardButton(self, "Back", "go-previous",
                                      self.returnPressed)
        buttonReturn.show()

        buttonBox.pack_end(buttonSave)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()

        self.pack_end(self.mainBox)
        self.pack_end(buttonBox)