Esempio n. 1
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)
Esempio n. 2
0
 def __init__(self):
     self.list = area.List(width=350, height=150)
     okButton = button.Button("Okay",
                              style={
                                  'width': 80,
                                  'height': 28,
                                  'margin': 8
                              })
     okButton.connect(CLICK, self.okayClicked)
     cancelButton = button.Button("Cancel",
                                  style={
                                      'width': 80,
                                      'height': 28,
                                      'margin': 8
                                  })
     cancelButton.connect(CLICK, self.close)
     body = table.Table()
     body.tr()
     body.td(basic.Label("Select your teacher"), colspan=2)
     body.tr()
     body.td(self.list, colspan=2)
     body.tr()
     body.td(okButton)
     body.td(cancelButton)
     Dialog.__init__(self, basic.Label("Teachers"), body)
Esempio n. 3
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)
Esempio n. 4
0
 def __init__(self,
              title="",
              default="",
              editable=True,
              special_button=None):
     self.list = area.List(width=350, height=150)
     self.list.connect(CHANGE, self.itemClicked, None)
     self.journalItems = []
     okButton = button.Button("Okay",
                              style={
                                  'width': 80,
                                  'height': 28,
                                  'margin': 8
                              })
     okButton.connect(CLICK, self.okayClicked)
     cancelButton = button.Button("Cancel",
                                  style={
                                      'width': 80,
                                      'height': 28,
                                      'margin': 8
                                  })
     cancelButton.connect(CLICK, self.close)
     self.input_item = input.Input(default)
     self.input_item.connect(CHANGE, self.itemTyped, None)
     self.input_item.disabled = not editable
     body = table.Table()
     body.tr()
     body.td(basic.Label(title), colspan=2)
     body.tr()
     body.td(self.list, colspan=2)
     body.tr()
     if special_button:
         body.td(self.input_item, colspan=1)
         body.td(special_button, colspan=1)
     else:
         body.td(self.input_item, colspan=2)
     body.tr()
     body.td(okButton)
     body.td(cancelButton)
     Dialog.__init__(self, basic.Label(title), body)
Esempio n. 5
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)