def __init__(self, parent, session): self.session = session conf = session.conf PreferencesDialog.__init__(self, "General") limits = Limits(self, session) ports = ListenPorts(self, session) pe = EncryptionSettings(self, session) dlsel = DataStorageSelector(self, conf) pad = Rectangle(self.evas) pad.color = 0, 0, 0, 0 pad.size_hint_min = 0, 10 sep1 = Separator(self) sep1.horizontal = True chk1 = Check(self) chk1.size_hint_align = 0.0, 0.0 chk1.text = "Delete original .torrent file when added" chk1.state = conf.getboolean("Settings", "delete_original") chk1.callback_changed_add(lambda x: conf.set("Settings", "delete_original", str(bool(chk1.state)))) chk2 = Check(self) chk2.size_hint_align = 0.0, 0.0 chk2.text = "Ask for confirmation on exit" chk2.state = conf.getboolean("Settings", "confirmations") chk2.callback_changed_add(lambda x: conf.set("Settings", "confirmations", str(bool(chk2.state)))) sep2 = Separator(self) sep2.horizontal = True for w in ports, limits, dlsel, pe, pad, sep1, chk1, chk2, sep2: w.show() self.box.pack_end(w)
def __init__(self, parent, session): self.session = session conf = session.conf PreferencesDialog.__init__(self, "General") limits = Limits(self, session) ports = ListenPorts(self, session) pe = EncryptionSettings(self, session) dlsel = DataStorageSelector(self, conf) pad = Rectangle(self.evas) pad.color = 0, 0, 0, 0 pad.size_hint_min = 0, 10 sep1 = Separator(self) sep1.horizontal = True chk1 = Check(self) chk1.size_hint_align = 0.0, 0.0 chk1.text = "Delete original .torrent file when added" chk1.state = conf.getboolean("Settings", "delete_original") chk1.callback_changed_add(lambda x: conf.set( "Settings", "delete_original", str(bool(chk1.state)))) chk2 = Check(self) chk2.size_hint_align = 0.0, 0.0 chk2.text = "Ask for confirmation on exit" chk2.state = conf.getboolean("Settings", "confirmations") chk2.callback_changed_add(lambda x: conf.set( "Settings", "confirmations", str(bool(chk2.state)))) sep2 = Separator(self) sep2.horizontal = True for w in ports, limits, dlsel, pe, pad, sep1, chk1, chk2, sep2: w.show() self.box.pack_end(w)
def colorselector_clicked(obj): win = StandardWindow("colorselector", "ColorSelector test", autodel=True, size=(350, 350)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) vbox = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(vbox) vbox.show() re = Rectangle(win.evas) re.size_hint_min = (1, 100) re.show() fr = Frame(win, text="Color View", content=re, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) vbox.pack_end(fr) fr.show() cs = Colorselector(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, color=(255, 160, 132, 255)) cs.callback_changed_add(cb_cs_changed, re) cs.callback_color_item_selected_add(cb_cs_item_sel, re) cs.callback_color_item_longpressed_add(cb_cs_item_lp, re) cs.show() fr = Frame(win, text="Color Selector", content=cs, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) vbox.pack_end(fr) fr.show() re.color = cs.color cs.palette_color_add(255, 90, 18, 255) cs.palette_color_add(255, 213, 0, 255) cs.palette_color_add(146, 255, 11, 255) cs.palette_color_add(9, 186, 10, 255) cs.palette_color_add(86, 201, 242, 255) cs.palette_color_add(18, 83, 128, 255) cs.palette_color_add(140, 53, 238, 255) cs.palette_color_add(255, 145, 145, 255) cs.palette_color_add(255, 59, 119, 255) cs.palette_color_add(133, 100, 69, 255) cs.palette_color_add(255, 255, 119, 255) cs.palette_color_add(133, 100, 255, 255) last_item = cs.palette_items_get()[-1] last_item.color = (255, 0, 0, 255) hbox = Box(win, horizontal=True, size_hint_align=FILL_AND_ALIGN_TOP, size_hint_weight=EXPAND_HORIZ) vbox.pack_end(hbox) hbox.show() bt = Button(win, text="Palette", size_hint_align=FILL_AND_ALIGN_TOP, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(lambda btn: cs.mode_set(ELM_COLORSELECTOR_PALETTE)) hbox.pack_end(bt) bt.show() bt = Button(win, text="Components", size_hint_align=FILL_AND_ALIGN_TOP, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add( lambda btn: cs.mode_set(ELM_COLORSELECTOR_COMPONENTS)) hbox.pack_end(bt) bt.show() bt = Button(win, text="Both", size_hint_align=FILL_AND_ALIGN_TOP, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(lambda btn: cs.mode_set(ELM_COLORSELECTOR_BOTH)) hbox.pack_end(bt) bt.show() hbox = Box(win, horizontal=True, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_HORIZ) vbox.pack_end(hbox) hbox.show() bt = Button(win, text="palette items", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(palette_items, cs) hbox.pack_end(bt) bt.show() bt = Button(win, text="palette selected item", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(selected_item_get, cs) hbox.pack_end(bt) bt.show() win.show()
def colorselector_clicked(obj): win = StandardWindow("colorselector", "ColorSelector test", autodel=True, size=(350,350)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) vbox = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(vbox) vbox.show() re = Rectangle(win.evas) re.size_hint_min = (1, 100) re.show() fr = Frame(win, text="Color View", content=re, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) vbox.pack_end(fr) fr.show() cs = Colorselector(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, color=(255, 160, 132, 255)) cs.callback_changed_add(cb_cs_changed, re) cs.callback_color_item_selected_add(cb_cs_item_sel, re) cs.callback_color_item_longpressed_add(cb_cs_item_lp, re) cs.show() fr = Frame(win, text="Color Selector", content=cs, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) vbox.pack_end(fr) fr.show() re.color = cs.color cs.palette_color_add(255, 90, 18, 255) cs.palette_color_add(255, 213, 0, 255) cs.palette_color_add(146, 255, 11, 255) cs.palette_color_add(9, 186, 10, 255) cs.palette_color_add(86, 201, 242, 255) cs.palette_color_add(18, 83, 128, 255) cs.palette_color_add(140, 53, 238, 255) cs.palette_color_add(255, 145, 145, 255) cs.palette_color_add(255, 59, 119, 255) cs.palette_color_add(133, 100, 69, 255) cs.palette_color_add(255, 255, 119, 255) cs.palette_color_add(133, 100, 255, 255) last_item = cs.palette_items_get()[-1] last_item.color = (255, 0, 0, 255) hbox = Box(win, horizontal=True, size_hint_align=FILL_AND_ALIGN_TOP, size_hint_weight=EXPAND_HORIZ) vbox.pack_end(hbox) hbox.show() bt = Button(win, text="Palette", size_hint_align=FILL_AND_ALIGN_TOP, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(lambda btn: cs.mode_set(ELM_COLORSELECTOR_PALETTE)) hbox.pack_end(bt) bt.show() bt = Button(win, text="Components", size_hint_align=FILL_AND_ALIGN_TOP, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(lambda btn: cs.mode_set(ELM_COLORSELECTOR_COMPONENTS)) hbox.pack_end(bt) bt.show() bt = Button(win, text="Both", size_hint_align=FILL_AND_ALIGN_TOP, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(lambda btn: cs.mode_set(ELM_COLORSELECTOR_BOTH)) hbox.pack_end(bt) bt.show() hbox = Box(win, horizontal=True, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_HORIZ) vbox.pack_end(hbox) hbox.show() bt = Button(win, text="palette items", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(palette_items, cs) hbox.pack_end(bt) bt.show() bt = Button(win, text="palette selected item", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(selected_item_get, cs) hbox.pack_end(bt) bt.show() win.show()