def __init__(self): # Create a new window Gtk.Window.__init__(self, title="Clustering Experimenter") # Containers self.vbox = Gtk.VBox(spacing=6) self.vbox.set_border_width(10) self.vbox_general = Gtk.VBox(spacing=6) self.vbox_windows = Gtk.VBox(spacing=6) self.hbox = Gtk.HBox(spacing=6) # General Configuration Frame self.frame_general = Gtk.Frame(label="General Settings") self.hbox_expname = Gtk.HBox(spacing=6) self.hbox_expdir = Gtk.HBox(spacing=6) # Button Boxes self.bbox1 = Gtk.VButtonBox(spacing=6) self.bbox2 = Gtk.VButtonBox(spacing=6) self.bbox3 = Gtk.HButtonBox(spacing=6) self.bbox1.set_layout(Gtk.ButtonBoxStyle.START) self.bbox2.set_layout(Gtk.ButtonBoxStyle.START) self.bbox3.set_layout(Gtk.ButtonBoxStyle.START) # Algorithms Frame self.frame_algorithms = Gtk.Frame(label="Algorithms Preferences") self.bbox2a = Gtk.VBox(False, 0)## self.bbox2b = Gtk.HBox(False, 0)## self.separator = Gtk.HSeparator() self.hbox_minK = Gtk.HBox(spacing=6) self.hbox_maxK = Gtk.HBox(spacing=6) # Packing containers self.hbox.pack_start(self.bbox1, True, True, 0) self.hbox.pack_start(self.bbox2, True, True, 0) self.vbox_general.pack_start(self.hbox_expname, True, True, 0) self.vbox_general.pack_start(self.hbox_expdir, True, True, 0) self.vbox_windows.pack_start(self.hbox, True, True, 0) self.frame_algorithms.add(self.bbox2a) self.vbox_windows.pack_start(self.frame_algorithms, True, True, 0)## self.vbox_windows.pack_start(self.bbox3, True, True, 10) self.frame_general.add(self.vbox_general) self.vbox.pack_start(self.frame_general, True, True, 0) self.vbox.pack_start(self.vbox_windows, True, True, 0) self.add(self.vbox) # General configuration labels and inputs boxes self.label_name = Gtk.Label("Experiment name: ") self.entry_name = Gtk.Entry() self.label_dir = Gtk.Label("Directory: ") self.entry_dir = Gtk.Entry() self.hbox_expname.pack_start(self.label_name, True, True, 0) self.hbox_expname.pack_start(self.entry_name, True, True, 0) self.hbox_expdir.pack_start(self.label_dir, True, True, 0) self.hbox_expdir.pack_start(self.entry_dir, True, True, 0) # Buttons to open other windows self.button_dataset = Gtk.Button(label="DataSets") self.button_real_partition = Gtk.Button(label="Real Partitions") self.button_generated_partition = Gtk.Button(label="Generated Partitions") self.button_similarity = Gtk.Button(label="Set Similarity Measure") self.button_external_validation = Gtk.Button(label="Set External Validation Indexes") self.button_internal_validation = Gtk.Button(label="Set Internal Validation Indexes") self.button_algorithm = Gtk.Button(label="Set Algorithms") self.button_execute = Gtk.Button(stock=Gtk.STOCK_EXECUTE) self.button_save = Gtk.Button(stock=Gtk.STOCK_SAVE) self.button_open = Gtk.Button(stock=Gtk.STOCK_OPEN) self.button_close = Gtk.Button(stock=Gtk.STOCK_CLOSE) # Algorithms Parameters self.label_min_cluster = Gtk.Label("Min. Cluster number: ") self.spin_min_cluster = Gtk.SpinButton() self.spin_min_cluster.set_adjustment(Gtk.Adjustment(2, 2, 100, 1, 10, 0)) self.spin_min_cluster.set_numeric(True) self.label_max_cluster = Gtk.Label("Max. Cluster number: ") self.spin_max_cluster = Gtk.SpinButton() self.spin_max_cluster.set_adjustment(Gtk.Adjustment(2, 2, 100, 1, 10, 0)) self.spin_max_cluster.set_numeric(True) self.label_times = Gtk.Label("Times to execute\nnon-deterministic\nalgorithms: ") self.spin_times = Gtk.SpinButton() self.spin_times.set_adjustment(Gtk.Adjustment(30, 1, 100, 1, 10, 0)) self.spin_times.set_numeric(True) self.hbox_minK.pack_start(self.label_min_cluster, True, False, 0) self.hbox_minK.pack_start(self.spin_min_cluster, True, False, 0) self.hbox_maxK.pack_start(self.label_max_cluster, True, False, 0) self.hbox_maxK.pack_start(self.spin_max_cluster, True, False, 0) # Connect the callback functions to the click event self.button_dataset.connect("clicked", self.on_button_dataset_clicked) self.button_real_partition.connect("clicked", self.on_button_real_partition_clicked, "Real") self.button_generated_partition.connect("clicked", self.on_button_generated_partition_clicked, "Generated") self.button_similarity.connect("clicked", self.on_button_similarity_clicked) self.button_external_validation.connect("clicked", self.on_button_external_validation_clicked) self.button_internal_validation.connect("clicked", self.on_button_internal_validation_clicked) self.button_algorithm.connect("clicked", self.on_button_algorithm_clicked) self.button_execute.connect("clicked", self.on_button_execute_clicked) self.button_save.connect("clicked", self.on_button_save_clicked) self.button_open.connect("clicked", self.on_button_open_clicked) self.button_close.connect("clicked", self.on_button_close_clicked) # put the buttons into the containers self.bbox1.pack_start(self.button_dataset, True, True, 6) self.bbox1.pack_start(self.button_real_partition, True, True, 0) self.bbox1.pack_start(self.button_generated_partition, True, True, 0) self.bbox2.pack_start(self.button_similarity, True, True, 0) self.bbox2.pack_start(self.button_external_validation, True, True, 0) self.bbox2.pack_start(self.button_internal_validation, True, True, 0) self.bbox2.pack_start(self.button_algorithm, True, True, 0) self.bbox2a.pack_start(self.hbox_minK, True, True, 4)## self.bbox2a.pack_start(self.hbox_maxK, True, True, 4)## self.bbox2a.pack_start(self.separator, True, True, 2) self.bbox2a.pack_start(self.bbox2b, True, True, 4)## self.bbox2b.pack_start(self.label_times, True, False, 0) self.bbox2b.pack_start(self.spin_times, True, False, 0) self.bbox3.pack_start(self.button_execute, True, True, 0) self.bbox3.pack_start(self.button_save, True, True, 0) self.bbox3.pack_start(self.button_open, True, True, 0) self.bbox3.pack_start(self.button_close, True, True, 0) # Create the other windows self.win_dataset = DataSetWindow() self.win_real_partition = RealPartitionWindow() self.win_generated_partition = GeneratedPartitionWindow() self.win_external_validation = ExternalValidationWindow() self.win_internal_validation = InternalValidationWindow() self.win_algorithm = AlgorithmWindow() self.win_similarity = SimilarityWindow()