def __init__(self, padre): gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) gtk.Window.set_position(self, gtk.WIN_POS_CENTER_ALWAYS) self.disco = padre.disco self.sector = get_sector_size(self.disco) self.lista = padre.lista self.acciones = padre.acciones self.particion_act = padre.fila_selec # Toma el inicio_part y fin_part de la particion seleccionada self.inicio_part = self.particion_act[TblCol.INICIO] self.fin_part = self.particion_act[TblCol.FIN] self.num_fila_act = get_row_index(self.lista, self.particion_act) self.particion_sig = get_next_row(self.lista, self.particion_act, self.num_fila_act) self.set_title(_("New partition")) self.set_resizable(0) self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) self.set_default_response(gtk.RESPONSE_CANCEL) #Tamaño de la partición lbl_tamano = gtk.Label(_("Size:")) lbl_tamano.set_alignment(0, 0.5) lbl_tamano.show() adj = gtk.Adjustment(self.fin_part, self.inicio_part, self.fin_part, \ 1.0, 1024.0, 0.0) self.escala = gtk.HScale() self.escala.set_digits(0) self.escala.set_draw_value(False) self.escala.set_adjustment(adj) self.escala.set_size_request(450, -1) self.escala.connect("value-changed", self.escala_on_changed) self.escala.show() self.lblsize = gtk.Label(humanize(self.escala.get_value() - \ self.inicio_part)) self.lblsize.show() hbox = gtk.VBox() hbox.show() hbox.pack_start(self.escala) hbox.pack_start(self.lblsize) fs_container = frame_fs(self, self.lista, self.particion_act) self.cmb_tipo = fs_container.cmb_tipo self.cmb_fs = fs_container.cmb_fs self.cmb_fs.connect('changed', self.cmb_fs_changed) self.cmb_montaje = fs_container.cmb_montaje self.entrada = fs_container.entrada fs_container.formatear.set_active(True) fs_container.formatear.set_sensitive(False) # Contenedor General self.cont = gtk.VBox() self.cont.pack_start(lbl_tamano) self.cont.pack_start(hbox, padding=15) self.cont.pack_start(fs_container) self.cont.show() self.vbox.pack_start(self.cont) response = self.run() self.process_response(response)
def __init__(self, disco, lista, fila, acciones): self.sector = get_sector_size(disco) self.lista = lista self.acciones = acciones self.num_fila_act = get_row_index(lista, fila) self.dispositivo = fila[TblCol.DISPOSITIVO] self.formato = fila[TblCol.FORMATO] self.inicio = fila[TblCol.INICIO] self.fin = fila[TblCol.FIN] self.usado = floatify(fila[TblCol.USADO]) gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) gtk.Window.set_position(self, gtk.WIN_POS_CENTER_ALWAYS) self.set_title("Redimensionar Partición") self.set_size_request(400, 200) self.set_resizable(0) self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) self.set_response_sensitive(gtk.RESPONSE_OK, False) self.set_default_response(gtk.RESPONSE_CANCEL) self.escala = gtk.HScale() self.escala.set_draw_value(False) adj = gtk.Adjustment(self.fin, self.inicio, self.get_maximum_size(), 1.0, 1024.0, 0.0) adj.connect("value-changed", self.escala_value_changed) self.escala.set_adjustment(adj) self.escala.show() self.lbl_dispositivo = gtk.Label("Partición '%s'" % self.dispositivo) self.lbl_dispositivo.show() self.lbl_tamano = gtk.Label('Tamaño') self.lbl_tamano_num = gtk.Label(humanize( self.get_new_partition_size())) self.vb_tamano = gtk.VBox() self.vb_tamano.add(self.lbl_tamano) self.vb_tamano.add(self.lbl_tamano_num) self.vb_tamano.show_all() self.lbl_usado = gtk.Label('Usado') self.lbl_usado_num = gtk.Label(humanize(self.usado)) self.vb_usado = gtk.VBox() self.vb_usado.add(self.lbl_usado) self.vb_usado.add(self.lbl_usado_num) self.vb_usado.show_all() self.lbl_libre = gtk.Label('Libre') self.lbl_libre_num = gtk.Label(humanize(self.get_free_space())) self.vb_libre = gtk.VBox() self.vb_libre.add(self.lbl_libre) self.vb_libre.add(self.lbl_libre_num) self.vb_libre.show_all() self.lbl_sin_particion = gtk.Label('Sin Particionar') self.lbl_sin_particion_num = gtk.Label( humanize(self.get_unasigned_space())) self.vb_sin_particion = gtk.VBox() self.vb_sin_particion.add(self.lbl_sin_particion) self.vb_sin_particion.add(self.lbl_sin_particion_num) self.vb_sin_particion.show_all() self.hb_leyenda = gtk.HBox() self.hb_leyenda.add(self.vb_tamano) self.hb_leyenda.add(self.vb_usado) self.hb_leyenda.add(self.vb_libre) self.hb_leyenda.add(self.vb_sin_particion) self.hb_leyenda.show_all() self.cont = gtk.VBox() self.cont.add(self.lbl_dispositivo) self.cont.add(self.hb_leyenda) self.cont.add(self.escala) self.cont.show() self.vbox.pack_start(self.cont) self.process_response(self.run())
def __init__(self, disco, lista, fila, acciones): self.sector = get_sector_size(disco) self.lista = lista self.acciones = acciones self.num_fila_act = get_row_index(lista, fila) self.dispositivo = fila[TblCol.DISPOSITIVO] self.formato = fila[TblCol.FORMATO] self.inicio = fila[TblCol.INICIO] self.fin = fila[TblCol.FIN] self.usado = floatify(fila[TblCol.USADO]) gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) gtk.Window.set_position(self, gtk.WIN_POS_CENTER_ALWAYS) self.set_title("Redimensionar Partición") self.set_size_request(400, 200) self.set_resizable(0) self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) self.set_response_sensitive(gtk.RESPONSE_OK, False) self.set_default_response(gtk.RESPONSE_CANCEL) self.escala = gtk.HScale() self.escala.set_draw_value(False) adj = gtk.Adjustment(self.fin, self.inicio, self.get_maximum_size(), 1.0, 1024.0, 0.0) adj.connect("value-changed", self.escala_value_changed) self.escala.set_adjustment(adj) self.escala.show() self.lbl_dispositivo = gtk.Label("Partición '%s'" % self.dispositivo) self.lbl_dispositivo.show() self.lbl_tamano = gtk.Label('Tamaño') self.lbl_tamano_num = gtk.Label(humanize(self.get_new_partition_size())) self.vb_tamano = gtk.VBox() self.vb_tamano.add(self.lbl_tamano) self.vb_tamano.add(self.lbl_tamano_num) self.vb_tamano.show_all() self.lbl_usado = gtk.Label('Usado') self.lbl_usado_num = gtk.Label(humanize(self.usado)) self.vb_usado = gtk.VBox() self.vb_usado.add(self.lbl_usado) self.vb_usado.add(self.lbl_usado_num) self.vb_usado.show_all() self.lbl_libre = gtk.Label('Libre') self.lbl_libre_num = gtk.Label(humanize(self.get_free_space())) self.vb_libre = gtk.VBox() self.vb_libre.add(self.lbl_libre) self.vb_libre.add(self.lbl_libre_num) self.vb_libre.show_all() self.lbl_sin_particion = gtk.Label('Sin Particionar') self.lbl_sin_particion_num = gtk.Label(humanize(self.get_unasigned_space())) self.vb_sin_particion = gtk.VBox() self.vb_sin_particion.add(self.lbl_sin_particion) self.vb_sin_particion.add(self.lbl_sin_particion_num) self.vb_sin_particion.show_all() self.hb_leyenda = gtk.HBox() self.hb_leyenda.add(self.vb_tamano) self.hb_leyenda.add(self.vb_usado) self.hb_leyenda.add(self.vb_libre) self.hb_leyenda.add(self.vb_sin_particion) self.hb_leyenda.show_all() self.cont = gtk.VBox() self.cont.add(self.lbl_dispositivo) self.cont.add(self.hb_leyenda) self.cont.add(self.escala) self.cont.show() self.vbox.pack_start(self.cont) self.process_response(self.run())