Coder Social home page Coder Social logo

gedit-focus-autosave's People

Contributors

careljonkhout avatar javadr avatar kassoulet avatar nengxu avatar orias avatar ozans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gedit-focus-autosave's Issues

Failed to load

Hi,

It seems the plugin doesn't work on gedit 2.30.4 with the following error ImportError: No module named gi.repository.

Greetings

Autosaving "unsaved" tabs

After losing a couple hours worth of unsaved tabs on a system crash, I searched for a solution. Found this plugin and after looking for a bit, I altered it to solve my personal issue. thought you might want to incorporate similar functionality. My patch does not address multiple user or security, so those are open issues.

essentially:

def on_focus_out_event(self, widget, focus):
    for doc in self.window.get_unsaved_documents():
        if doc.is_untouched():
            continue
        uri = doc.get_uri()
        if uri is None:
            now = datetime.datetime.now();
            uri = now.strftime("file:///tmp/gedit.unsaved.%y%m%d-%H%M%S.txt");
            doc.set_uri(uri)
        doc.save(0)

cheers.

Can't save on losing focus when file is untitled.

Whenever I open a new file, it doesn't save it automatically on losing focus and make the following error: (in fedora 31, python 3.7, gedit 3.34.1)

AttributeError: 'Document' object has no attribute 'set_location'

Can't save on focus losing

With gedit 3 that time ;)

When gedit loses its focus, here what happen:

Traceback (most recent call last):
  File "/home/maya/.local/share/gedit/plugins/focus_autosave.py", line 33, in on_focus_out_event
    tab.emit('save')
TypeError: <Tab object at 0x26da0a0 (GeditTab at 0x240c360)>: unknown signal name: save

Sorry, for all my bug reports ^^"

Failed to load, again

With gedit 2.30.4, again :p

When I want to enable the plugin, gedit freezes with the following trace:

/usr/lib64/python2.7/site-packages/gi/module.py:138: Warning: cannot register existing type `GtkWidget'
  g_type = info.get_g_type()
/usr/lib64/python2.7/site-packages/gi/module.py:138: Warning: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
  g_type = info.get_g_type()
/usr/lib64/python2.7/site-packages/gi/module.py:138: Warning: cannot register existing type `GtkBuildable'
  g_type = info.get_g_type()
/usr/lib64/python2.7/site-packages/gi/module.py:138: Warning: g_type_interface_add_prerequisite: assertion `G_TYPE_IS_INTERFACE (interface_type)' failed
  g_type = info.get_g_type()
/usr/lib64/python2.7/site-packages/gi/module.py:138: Warning: g_once_init_leave: assertion `initialization_value != 0' failed
  g_type = info.get_g_type()
/usr/lib64/python2.7/site-packages/gi/module.py:142: Warning: g_type_get_qdata: assertion `node != NULL' failed
  type_ = g_type.pytype

While it seems to be the only plugin to save on lost focus, it would be great to be able to use it ;)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.