updated h2inc_gtk.py
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<object class="GtkLabel" id="source_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
@@ -81,7 +81,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<object class="GtkEntry" id="source_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="margin_top">5</property>
|
||||
@@ -114,7 +114,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<object class="GtkLabel" id="destination_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
@@ -136,7 +136,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry2">
|
||||
<object class="GtkEntry" id="destination_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
@@ -171,7 +171,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton1">
|
||||
<object class="GtkCheckButton" id="include_checkbutton">
|
||||
<property name="label" translatable="yes">Create "include" folder if it does not exist.</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
|
@@ -155,7 +155,18 @@ class Handler:
|
||||
|
||||
response = dialog.run()
|
||||
if response == Gtk.ResponseType.OK:
|
||||
sourcedir_filecnt(dialog.get_filename())
|
||||
cnt = sourcedir_filecnt(dialog.get_filename())
|
||||
if cnt >0:
|
||||
print(cnt)
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file("h2inc.glade")
|
||||
obj = builder.get_object
|
||||
obj("destination_label").set_sensitive(True)
|
||||
obj("destination_entry").set_sensitive(True)
|
||||
obj("destination_button").set_sensitive(True)
|
||||
obj("include_checkbutton").set_sensitive(True)
|
||||
while Gtk.events_pending():
|
||||
Gtk.main_iteration()
|
||||
elif response == Gtk.ResponseType.CANCEL:
|
||||
print("Cancel")
|
||||
|
||||
@@ -180,14 +191,6 @@ class ExampleApp:
|
||||
self.obj("window").set_wmclass("Filechooser example","Filechooser example")
|
||||
self.obj("window").show_all()
|
||||
|
||||
#add filters to filechooser dialog
|
||||
self.obj("filefilter").set_name("Image files")
|
||||
self.obj("filechooser_dialog").add_filter(self.obj("filefilter"))
|
||||
self.obj("png_filter").set_name("PNG files")
|
||||
self.obj("filechooser_dialog").add_filter(self.obj("png_filter"))
|
||||
self.obj("jpg_filter").set_name("JPG files")
|
||||
self.obj("filechooser_dialog").add_filter(self.obj("jpg_filter"))
|
||||
|
||||
#add buttons to headerbar of Glade generated dialog
|
||||
button = Gtk.Button.new_from_stock(Gtk.STOCK_CANCEL)
|
||||
button.set_property("can-default",True)
|
||||
|
Reference in New Issue
Block a user