コード例 #1
0
    def _create_ui(self):
        self._frame = gtk.Frame()
        self._frame.set_label(_("Settings"))

        vbox = gtk.VBox(homogeneous=False,
                        spacing = 5)
        self._frame.add(vbox)

        self._auto_cb = gtk.CheckButton(_("Mount Disk Automatically"))
        vbox.pack_start(self._auto_cb, expand=False)
        self._table = gtk.Table(rows=4, columns = 3)
        vbox.add(self._table)

        self._mp_lb = gtk.Label(_("Mount Point:"))
        self._fs_lb = gtk.Label(_("File System:"))
        self._op_lb = gtk.Label(_("Options:"))
        self._mp_txt = gtk.Entry()
        self._prepare_fs_box()
        self._op_txt = gtk.Entry()
        self._def_op_btn = gtk.Button(_("Default Options"))
        self._ok_btn = gtk.Button(_("OK"))
        self._ca_btn = gtk.Button(_("Cancel"))
        #TODO: add buttons to ui (vbox)
        self._add_all_to_table()
        self._table.show_all()

        hbox = gtk.HBox(homogeneous=False,
                        spacing=5)
        hbox.pack_end(self._ok_btn, expand=False)
        hbox.pack_end(self._ca_btn, expand=False)
        vbox.pack_end(hbox, expand=False)
        self.add(self._frame)
        self._frame.show_all()
        self._fill_ui()
コード例 #2
0
    def _create_ui(self):
        # creates ui
        self.check_btn = gtk.CheckButton()

        self._name_lb = gtk.Label()
        self._name_lb.set_alignment(0.0, 0.5)
        self._name_lb.set_markup("<b>"+self._name+"</b>")

        self._info = gtk.Label()
        self._info.set_alignment(0.0, 0.5)

        self._set_mounted()

        self.edit_btn = gtk.Button(_("Edit"))

        self.attach(self.check_btn, 0, 1, 0, 2,
                    gtk.SHRINK, gtk.SHRINK)

        if self._mount:
            pixbuf = get_icon("drive-harddisk", 32)
        else:
            pixbuf = get_icon("drive-removable-media", 32)

        self._icon = gtk.image_new_from_pixbuf(pixbuf)
        self.attach(self._icon, 1, 2, 0, 2,
                   gtk.SHRINK, gtk.SHRINK)
        self.attach(self._name_lb, 2, 3, 0, 1,
                    gtk.EXPAND|gtk.FILL, gtk.SHRINK)
        self.attach(self._info, 2, 3, 1, 2,
                    gtk.EXPAND|gtk.FILL, gtk.SHRINK)
        self.attach(self.edit_btn, 3, 4, 0, 2,
                    gtk.SHRINK, gtk.SHRINK)
コード例 #3
0
 def __init__(self):
     """init the variables"""
     super(DiskManagerAddon, self).__init__()
     self._uuid = "9aaeab69-8fad-458f-878a-09277be0a6ec"
     self._icon_name = "drive-harddisk"
     self._label = _("Disk Manager")
     self._widget = DiskManager
コード例 #4
0
 def _try_to(self, func, data, path=""):
     #try to (mount | umount | removeEntry | addEntry)
     try:
         if func == "mount":
             self.iface.mount(data["name"], path)
             self.show_disks()
         elif func == "umount":
             self.iface.umount(data["name"])
             self.show_disks()
         elif func == "removeEntry":
             self.iface.removeEntry(data["device"])
         elif func == "addEntry":
             self.iface.addEntry(data["device"],
                                 data["entry"][0],
                                 data["entry"][1],
                                 data["entry"][2])
         #widget.set_mode(func == "mount", path)
     except Exception, e:
         if "Comar.PolicyKit" in e._dbus_error_name:
             open_error_dialog(_("Access Denied"))
         else:
             open_error_dialog(unicode(e))
         if (func == "mount") | (func == "umount"):
             widget = data["widget"]
             widget.set_mode(not func == "mount")
コード例 #5
0
    def _set_mounted(self):
        if self._mount is not None:
            self._info.set_text(_("Mounted at %s") % self._mount)
            self.check_btn.set_active(True)
        else:

            self._info.set_text("")
            self.check_btn.set_active(False)
コード例 #6
0
 def _set_style(self):
     self.set_modal(True)
     self.set_title(_("Edit Settings"))
     self.set_default_size(480, 190)
コード例 #7
0
 def _set_style(self):
     self.set_title(_("Disk Manager"))
     self.set_default_size(483, 300)
     self.set_icon_name("drive-harddisk")