コード例 #1
0
ファイル: slider.py プロジェクト: illume/zanthor
    def __init__(self, value, min, max, size, step=1, **params):
        params.setdefault('cls', 'vscrollbar')

        table.Table.__init__(self, **params)

        self.slider = _slider(value,
                              _SLIDER_VERTICAL,
                              min,
                              max,
                              size,
                              step=step,
                              cls=self.cls + '.slider')

        self.tr()
        self.minus = basic.Image(self.style.minus)
        self.minus.connect(MOUSEBUTTONDOWN, self._click, -1)
        self.td(self.minus)

        self.tr()
        self.td(self.slider)
        self.slider.connect(CHANGE, self.send, CHANGE)

        self.tr()
        self.minus = basic.Image(self.style.minus)
        self.minus.connect(MOUSEBUTTONDOWN, self._click, -1)
        self.td(self.minus)

        self.tr()
        self.plus = basic.Image(self.style.plus)
        self.plus.connect(MOUSEBUTTONDOWN, self._click, 1)
        self.td(self.plus)
コード例 #2
0
 def __init__(self, title_txt="File Browser", button_txt="Okay", cls="filedialog", path=None):
     if not path: self.curdir = os.getcwd()
     else: self.curdir = path
     import app
     self.dir_img = basic.Image(app.App.app.theme.get(cls+'.folder', '', 'image'))
     td_style = {'padding_left': 4,
                 'padding_right': 4,
                 'padding_top': 2,
                 'padding_bottom': 2}
     self.title = basic.Label(title_txt, cls=cls+".title.label")
     self.body = table.Table()
     self.list = area.List(width=350, height=150)
     self.input_dir = input.Input(cls=cls+".input")
     self.input_file = input.Input(cls=cls+".input")
     self._list_dir_()
     self.button_ok = button.Button(button_txt)
     self.body.tr()
     self.body.td(basic.Label("Path", cls=cls+".label"), style=td_style, align=-1)
     self.body.td(self.input_dir, style=td_style)
     self.body.tr()
     self.body.td(basic.Label("File", cls=cls+".label"), style=td_style, align=-1)
     self.body.td(self.input_file, style=td_style)
     self.body.td(self.button_ok, style=td_style)
     self.body.tr()
     self.body.td(self.list, colspan=3, style=td_style)
     self.list.connect(CHANGE, self._item_select_changed_, None)
     self.button_ok.connect(CLICK, self._button_okay_clicked_, None)
     self.value = None
     Dialog.__init__(self, self.title, self.body)
コード例 #3
0
ファイル: select.py プロジェクト: italomaia/turtle-linux
    def __init__(self, value=None, **params):
        params.setdefault('cls', 'select')
        table.Table.__init__(self, **params)

        self.top_selected = button.Button(cls=self.cls + ".selected")
        table.Table.add(self, self.top_selected)  #,hexpand=1,vexpand=1)#,0,0)
        self.top_selected.value = basic.Label(" ",
                                              cls=self.cls + ".option.label")

        self.top_arrow = button.Button(basic.Image(self.style.arrow),
                                       cls=self.cls + ".arrow")
        table.Table.add(self, self.top_arrow)  #,hexpand=1,vexpand=1) #,1,0)

        self.options = table.Table()  #style={'border':3})
        self.options_first = None

        self.options.tr()
        self.spacer_top = basic.Spacer(0, 0)
        self.options.add(self.spacer_top)

        self.options.tr()
        self._options = table.Table(cls=self.cls + ".options")
        self.options.add(self._options)

        self.options.tr()
        self.spacer_bottom = basic.Spacer(0, 0)
        self.options.add(self.spacer_bottom)

        self.options.connect(BLUR, self._close, None)
        self.spacer_top.connect(CLICK, self._close, None)
        self.spacer_bottom.connect(CLICK, self._close, None)

        self.values = []
        self.value = value
コード例 #4
0
 def __init__(self, title, message):
     title = basic.Label(title)
     main = table.Table()
     import app
     warningIcon = basic.Image(
         app.App.app.theme.get('warningdialog.warning', '', 'image'))
     if type(message) is list:
         if len(message) >= 1:
             main.tr()
             main.td(warningIcon, rowspan=len(message), style={'margin': 5})
             main.td(basic.Label(message[0]), align=-1)
         for aMessage in message[1:]:
             main.tr()
             main.td(basic.Label(aMessage), align=-1, colspan=2)
     else:
         main.tr()
         main.td(warningIcon)
         main.td(basic.Label(message), align=-1, colspan=2)
     main.tr()
     self.okayButton = button.Button("Okay")
     self.okayButton.connect(CLICK, self.okayClicked)
     self.cancelButton = button.Button("Cancel")
     self.cancelButton.connect(CLICK, self.close)
     main.td(basic.Spacer(1, 1))
     main.td(self.okayButton, align=1, style={'margin': 10})
     main.td(self.cancelButton, align=-1, style={'margin': 10})
     Dialog.__init__(self, title, main)
コード例 #5
0
    def __init__(self,
                 title_txt="File Browser",
                 button_txt="Okay",
                 cls="dialog",
                 path=None):
        """FileDialog constructor.

        Keyword arguments:
            title_txt -- title text
            button_txt -- button text
            path -- initial path

        """

        cls1 = 'filedialog'
        if not path: self.curdir = os.getcwd()
        else: self.curdir = path
        self.dir_img = basic.Image(
            pguglobals.app.theme.get(cls1 + '.folder', '', 'image'))
        td_style = {
            'padding_left': 4,
            'padding_right': 4,
            'padding_top': 2,
            'padding_bottom': 2
        }
        self.title = basic.Label(title_txt, cls=cls + ".title.label")
        self.body = table.Table()
        self.list = area.List(width=350, height=150)
        self.input_dir = input.Input()
        self.input_file = input.Input()
        self._list_dir_()
        self.button_ok = button.Button(button_txt)
        self.body.tr()
        self.body.td(basic.Label("Folder"), style=td_style, align=-1)
        self.body.td(self.input_dir, style=td_style)
        self.body.tr()
        self.body.td(self.list, colspan=3, style=td_style)
        self.list.connect(CHANGE, self._item_select_changed_, None)
        self.button_ok.connect(CLICK, self._button_okay_clicked_, None)
        self.body.tr()
        self.body.td(basic.Label("File"), style=td_style, align=-1)
        self.body.td(self.input_file, style=td_style)
        self.body.td(self.button_ok, style=td_style)
        self.value = None
        Dialog.__init__(self, self.title, self.body)
コード例 #6
0
ファイル: deprecated.py プロジェクト: italomaia/turtle-linux
    def __init__(self,
                 data,
                 cols=0,
                 rows=0,
                 tool_cls='tool',
                 value=None,
                 **params):
        print 'gui.Toolbox', 'Scheduled to be deprecated.'
        params.setdefault('cls', 'toolbox')
        table.Table.__init__(self, **params)

        if cols == 0 and rows == 0: cols = len(data)
        if cols != 0 and rows != 0: rows = 0

        self.tools = {}

        _value = value

        g = group.Group()
        self.group = g
        g.connect(CHANGE, self._change, None)
        self.group.value = _value

        x, y, p, s = 0, 0, None, 1
        for ico, value in data:
            #from __init__ import theme
            import app
            img = app.App.app.theme.get(tool_cls + "." + ico, "", "image")
            if img:
                i = basic.Image(img)
            else:
                i = basic.Label(ico, cls=tool_cls + ".label")
            p = button.Tool(g, i, value, cls=tool_cls)
            self.tools[ico] = p
            #p.style.hexpand = 1
            #p.style.vexpand = 1
            self.add(p, x, y)
            s = 0
            if cols != 0: x += 1
            if cols != 0 and x == cols: x, y = 0, y + 1
            if rows != 0: y += 1
            if rows != 0 and y == rows: x, y = x + 1, 0
コード例 #7
0
 def __init__(self,
              title_txt="File Browser",
              button_txt="Okay",
              cls="dialog",
              path=None,
              filter=None,
              default="",
              favorites=None,
              special_button=None):
     cls1 = 'filedialog'
     self.filter = filter
     if not path: self.curdir = os.getcwd()
     else: self.curdir = path
     import app
     self.dir_img = basic.Image(
         app.App.app.theme.get(cls1 + '.folder', '', 'image'))
     td_style = {
         'padding_left': 4,
         'padding_right': 4,
         'padding_top': 2,
         'padding_bottom': 2
     }
     self.title = basic.Label(title_txt, cls=cls + ".title.label")
     self.body = table.Table()
     self.list = area.List(width=350, height=150)
     self.input_dir = input.Input()
     self.input_file = input.Input(default)
     self._list_dir_()
     self.button_redirect = button.Button("Go")
     self.button_ok = button.Button(button_txt)
     self.body.tr()
     self.body.td(basic.Label("Folder"), style=td_style, align=-1)
     self.body.td(self.input_dir, style=td_style)
     self.body.td(self.button_redirect, style=td_style)
     self.button_redirect.connect(CLICK, self._button_redirect_clicked_,
                                  None)
     if favorites or special_button:
         self.body.tr()
         d = document.Document()
         if special_button:
             d.add(special_button)
         for icon, text, link in favorites:
             t = table.Table()
             t.tr()
             t.td(basic.Image(icon))
             t.tr()
             t.td(basic.Label(text))
             b = button.Button(t)
             b.connect(CLICK, self._button_redirect_link_, link)
             d.space((20, 28))
             d.add(b)
         self.body.td(d, colspan=3)
     self.body.tr()
     self.body.td(self.list, colspan=3, style=td_style)
     self.list.connect(CHANGE, self._item_select_changed_, None)
     self.button_ok.connect(CLICK, self._button_okay_clicked_, None)
     self.body.tr()
     self.body.td(basic.Label("File"), style=td_style, align=-1)
     self.body.td(self.input_file, style=td_style)
     self.body.td(self.button_ok, style=td_style)
     self.value = None
     Dialog.__init__(self, self.title, self.body)