def handle_quit(self, action, parameter): log.debug("Emitting quit...") emit('quit') self.quit() log.debug("Goodbye! Application terminated.")
def auto_clipboard(self, clipboard, parameter): if AppState["app"] != State.AUTOSAVE: return False name = value = clipboard.wait_for_text() if not value: log.error("No value to save - aborting") return False emit("add_button", Copy(Snippet(name, value)))
def on_goto(self, button: Gtk.Button): log.debug(f"Going to {self.destination}") state = AppState["app"] if state == State.REMOVE: log.debug("Removing button...") emit("remove_button", self) if state != State.REMOVE: emit("change_button_grid", self.current_position, self.destination)
def on_save(self, button): name = self.entry.get_text().strip() if not name: log.error("No folder name to save - aborting") emit("error_show_dialog", "Soo, the value is missing, it's required.") return False log.debug("Adding new folder to snippets...") emit("add_folder", name) self.destroy()
def do_activate(self): log.debug("Lift off!") log.debug("App state NORMAL") AppState['app'] = ( State.NORMAL ) # TODO: take out common from Register, signal_bus and make AppState out of it log.debug("Emitting start_app...") emit('start_app') log.debug("All green. Welcome to application.")
def autosave_on(self, button): self._deactive_rest_buttons(ToggleButtons.autosave) if button.get_active(): AppState["app"] = State.AUTOSAVE emit("autosave_on") self.handle = self.clip.connect("owner-change", self.auto_clipboard) log.debug("Autosave on") else: emit("autosave_off") AppState["app"] = State.NORMAL self.clip.disconnect(self.handle) log.debug("Autosave off")
def on_save(self, button): name = self.entry.get_text().strip() value = self.textbuffer.get_text(self.textbuffer.get_start_iter(), self.textbuffer.get_end_iter(), False).strip() if not value: log.error("No value to save - aborting") emit("error_show_dialog", "Soo, the value is missing, it's required.") return False if not name: name = value log.debug("Adding new button to a file cabinet...") emit("add_button", Copy(Snippet(name, value))) self.destroy()
def main_function(config_file): # create and run the application, exit with the value returned by # running the program log.debug("Initializing services...") import app.style # noqa from app.widgets import application # noqa from app.builder import builder # noqa import app.config # noqa # TODO: still loding config file from the repository # config_file = os.path.join(PROJECT_DIR, "config/example.conf") # __.Config.load_config_file(config_file) log.debug("Loading Widgets usig GtkBuilder...") builder.set_application(application) # works without it builder.add_from_file("app/layout.glade") __.main_window = builder.get_object("main_window") __.main_box = builder.get_object("main_box") welcome_sing = builder.get_object("welcome_sign") __.main_box.remove(welcome_sing) # TODO: why? # load the events from folders.layout_events import Layout_events # noqa builder.connect_signals(Layout_events) log.debug("Importing stories...") import folders.stories # noqa emit('load_style', os.path.join(PROJECT_DIR, "folders", "app.css")) log.debug("Starting the Application...") exit_status = application.run(sys.argv) log.debug("Returning exit status value...") return exit_status
def on_copy(self, button): log.debug("Handling the button press...") state = AppState["app"] if state == State.REMOVE: log.debug("Removing button...") emit("remove_button", self) if state in [State.NORMAL, State.AUTOSAVE]: log.debug("Coping value...") emit("copy", button.content) emit("preview_content", button.content) if state == State.EDIT: log.debug("Editing button...") emit("edit_button", self)
def start_app(): emit(signals.load_default_styles)
def start_app(): load_config() emit('load_style', os.path.join(PROJECT_DIR, "copypaster", "app.css"))
def reload_css(self, *args): emit(signals.reload_default_styles)
def add_folder(self, button): log.debug("Begin adding folder") emit("open_add_folder_dialog")
def add(self, button): log.debug("Begin adding button") emit("open_add_button_dialog")