def __init__(self, title, display_name, save_button_text, validate_name, check_name=None): WindowBuilder.__init__(self, 'save-file') if check_name is not None: self.check_name = check_name self.validate_name = validate_name self.dialog.set_title(title) self.dialog.set_default_response(gtk.RESPONSE_OK) self.message_label.set_text("Please enter a new name for '%s'" % display_name) self.name_entry.connect('changed', self.__update_save_sensitivity) self.__update_save_sensitivity() self.save_button.set_label(save_button_text) self.save_button.set_image( gtk.image_new_from_stock('gtk-save', gtk.ICON_SIZE_BUTTON))
def __init__(self): WindowBuilder.__init__(self, "preferences") self.dialog.connect("response", self.__on_response) self.dialog.connect("delete-event", self.__on_delete_event) global_settings.watch("editor-font-is-custom", self.__on_notify_editor_font_is_custom) self.__on_notify_editor_font_is_custom() self.editor_font_custom_check_button.connect("toggled", self.__on_editor_font_custom_check_button_toggled) self.__on_editor_font_custom_check_button_toggled() global_settings.watch("editor-font-name", self.__on_notify_editor_font_name) self.__on_notify_editor_font_name() self.editor_font_button.connect("font-set", self.__on_editor_font_set) global_settings.watch("doc-tooltip-font-is-custom", self.__on_notify_doc_tooltip_font_is_custom) self.__on_notify_doc_tooltip_font_is_custom() self.doc_tooltip_font_custom_check_button.connect( "toggled", self.__on_doc_tooltip_font_custom_check_button_toggled ) self.__on_doc_tooltip_font_custom_check_button_toggled() global_settings.watch("doc-tooltip-font-name", self.__on_notify_doc_tooltip_font_name) self.__on_notify_doc_tooltip_font_name() self.doc_tooltip_font_button.connect("font-set", self.__on_doc_tooltip_font_set) global_settings.watch("autocomplete", self.__on_notify_autocomplete) self.__on_notify_autocomplete() self.autocomplete_check_button.connect("toggled", self.__on_autocomplete_check_button_toggled)
def __init__(self): WindowBuilder.__init__(self, 'preferences') self.dialog.connect('response', self.__on_response) self.dialog.connect('delete-event', self.__on_delete_event) global_settings.connect('notify::editor-font-is-custom', self.__on_notify_editor_font_is_custom) self.__on_notify_editor_font_is_custom() self.editor_font_custom_check_button.connect('toggled', self.__on_editor_font_custom_check_button_toggled) self.__on_editor_font_custom_check_button_toggled() global_settings.connect('notify::editor-font-name', self.__on_notify_editor_font_name) self.__on_notify_editor_font_name() self.editor_font_button.connect('font-set', self.__on_editor_font_set) global_settings.connect('notify::doc-tooltip-font-is-custom', self.__on_notify_doc_tooltip_font_is_custom) self.__on_notify_doc_tooltip_font_is_custom() self.doc_tooltip_font_custom_check_button.connect('toggled', self.__on_doc_tooltip_font_custom_check_button_toggled) self.__on_doc_tooltip_font_custom_check_button_toggled() global_settings.connect('notify::doc-tooltip-font-name', self.__on_notify_doc_tooltip_font_name) self.__on_notify_doc_tooltip_font_name() self.doc_tooltip_font_button.connect('font-set', self.__on_doc_tooltip_font_set) global_settings.connect('notify::autocomplete', self.__on_notify_autocomplete) self.__on_notify_autocomplete() self.autocomplete_check_button.connect('toggled', self.__on_autocomplete_check_button_toggled)
def __init__(self): WindowBuilder.__init__(self, 'new-notebook') self.name_entry.connect('changed', self.__update_create_sensitivity) self.__update_create_sensitivity() self.description_text_view.set_accepts_tab(False) self.other_folder_radio_button.set_group(self.default_folder_radio_button) self.other_folder_radio_button.connect('toggled', self.__update_other_folder_sensitivity) self.__update_other_folder_sensitivity(self.other_folder_radio_button) self.other_folder_chooser.set_filename(global_settings.notebooks_dir) self.create_button.set_image(gtk.image_new_from_stock('gtk-new', gtk.ICON_SIZE_BUTTON))
def __init__(self, title, display_name, save_button_text, check_name=None): WindowBuilder.__init__(self, 'save-file') if check_name != None: self.check_name = check_name self.dialog.set_title(title) self.dialog.set_default_response(gtk.RESPONSE_OK) self.message_label.set_text("Please enter a new name for '%s'" % display_name) self.name_entry.connect('changed', self.__update_save_sensitivity) self.__update_save_sensitivity() self.save_button.set_label(save_button_text) self.save_button.set_image(gtk.image_new_from_stock('gtk-save', gtk.ICON_SIZE_BUTTON))
def __init__(self): WindowBuilder.__init__(self, 'new-notebook') self.name_entry.connect('changed', self.__update_create_sensitivity) self.__update_create_sensitivity() self.description_text_view.set_accepts_tab(False) self.other_folder_radio_button.set_group( self.default_folder_radio_button) self.other_folder_radio_button.connect( 'toggled', self.__update_other_folder_sensitivity) self.__update_other_folder_sensitivity(self.other_folder_radio_button) self.other_folder_chooser.set_filename(global_settings.notebooks_dir) self.create_button.set_image( gtk.image_new_from_stock('gtk-new', gtk.ICON_SIZE_BUTTON))
def main(): # Initialisation de pygame pygame.init() # Creation d'un window builder builder = WindowBuilder(1000) builder.makeWindow() builder.createGrid() # Creation d'un modifier modifier = WindowModifier(builder.fenetre, builder.rect_width, builder.rect_height, builder.margin) # Controleur de la boucle continuer = True gameOn = False while continuer: for event in pygame.event.get(): if event.type == QUIT: continuer = False if event.type == MOUSEBUTTONDOWN and event.button == 1: modifier.modifyColors(event.pos[0], event.pos[1]) if event.type == KEYDOWN and event.key == K_SPACE: game = GameOfLife(modifier) gameOn = not gameOn if gameOn: game.nextGen() modifier.colors = game.colors time.sleep(0.3) modifier.redrawGrid()
def __init__(self): WindowBuilder.__init__(self, 'preferences') self.dialog.connect('response', self.__on_response) self.dialog.connect('delete-event', self.__on_delete_event) global_settings.watch('editor-font-is-custom', self.__on_notify_editor_font_is_custom) self.__on_notify_editor_font_is_custom() self.editor_font_custom_check_button.connect( 'toggled', self.__on_editor_font_custom_check_button_toggled) self.__on_editor_font_custom_check_button_toggled() global_settings.watch('editor-font-name', self.__on_notify_editor_font_name) self.__on_notify_editor_font_name() self.editor_font_button.connect('font-set', self.__on_editor_font_set) global_settings.watch('doc-tooltip-font-is-custom', self.__on_notify_doc_tooltip_font_is_custom) self.__on_notify_doc_tooltip_font_is_custom() self.doc_tooltip_font_custom_check_button.connect( 'toggled', self.__on_doc_tooltip_font_custom_check_button_toggled) self.__on_doc_tooltip_font_custom_check_button_toggled() global_settings.watch('doc-tooltip-font-name', self.__on_notify_doc_tooltip_font_name) self.__on_notify_doc_tooltip_font_name() self.doc_tooltip_font_button.connect('font-set', self.__on_doc_tooltip_font_set) global_settings.watch('autocomplete', self.__on_notify_autocomplete) self.__on_notify_autocomplete() self.autocomplete_check_button.connect( 'toggled', self.__on_autocomplete_check_button_toggled)
def on_notebook_properties(self, action): builder = WindowBuilder('notebook-properties') builder.dialog.set_transient_for(self.window) builder.dialog.set_title("%s - Properties" % self.notebook.info.name) builder.name_entry.set_text(self.notebook.info.name) builder.name_entry.set_sensitive(False) builder.description_text_view.get_buffer( ).props.text = self.notebook.info.description response = builder.dialog.run() if response == gtk.RESPONSE_OK: self.notebook.info.description = builder.description_text_view.get_buffer( ).props.text builder.dialog.destroy()
def __init__(self): WindowBuilder.__init__(self, 'open-notebook') tree = self.notebooks_tree self.model = gtk.ListStore(gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT) for info in application.get_notebook_infos(): iter = self.model.append() state = application.state.get_notebook_state(info.folder) self.model.set_value(iter, 0, info) self.model.set_value(iter, 1, state) tree.set_model(self.model) ############################## name_column = gtk.TreeViewColumn("Name") tree.append_column(name_column) cell_renderer = gtk.CellRendererText() name_column.pack_start(cell_renderer, True) name_column.set_cell_data_func(cell_renderer, self.__name_data_func) self.model.set_sort_func(0, self.__name_column_sort) name_column.set_sort_column_id(0) ############################## description_column = gtk.TreeViewColumn("Description") description_column.set_expand(True) tree.append_column(description_column) cell_renderer = gtk.CellRendererText() cell_renderer.props.ellipsize = pango.ELLIPSIZE_END description_column.pack_start(cell_renderer, True) description_column.set_cell_data_func(cell_renderer, self.__description_data_func) ############################## modified_column = gtk.TreeViewColumn("Last Modified") tree.append_column(modified_column) cell_renderer = gtk.CellRendererText() modified_column.pack_start(cell_renderer, True) modified_column.set_cell_data_func(cell_renderer, self.__modified_data_func) self.model.set_sort_func(2, self.__modified_column_sort) modified_column.set_sort_column_id(2) ############################## opened_column = gtk.TreeViewColumn("Last Opened") tree.append_column(opened_column) cell_renderer = gtk.CellRendererText() opened_column.pack_start(cell_renderer, True) opened_column.set_cell_data_func(cell_renderer, self.__opened_data_func) self.model.set_sort_func(3, self.__opened_column_sort) opened_column.set_sort_column_id(3) self.model.set_sort_column_id(3, gtk.SORT_ASCENDING) ############################## tree.get_selection().connect('changed', self.__update_open_button_sensitivity) self.__update_open_button_sensitivity() tree.connect('row-activated', self.on_row_activated)