-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to set master document persistant #27
Comments
I've gotten it to save my master document, very very crudely. Here's how I've done it, apologies for the inline code and no pull request, I'm not at my main machine so no SSH keys here def populate_from_disk(self):
try: filehandle = open(self.pathname + '/workspace.pickle', 'rb')
except IOError: pass
else:
try: data = pickle.load(filehandle)
except EOFError:
return
else:
for item in sorted(data['open_documents'].values(), key=lambda val: val['last_activated']):
self.create_document_from_filename(item['filename'])
for item in data['recently_opened_documents'].values():
self.update_recently_opened_document(item['filename'], item['date'], notify=False)
self.add_change_code('update_recently_opened_documents', self.recently_opened_documents)
if data['master_document'] is not None:
document = LaTeXDocument(self.pathname)
document.set_filename(data['master_document'])
self.set_one_document_master(document)
def save_to_disk(self):
try: filehandle = open(self.pathname + '/workspace.pickle', 'wb')
except IOError: pass
else:
open_documents = dict()
for document in self.open_documents:
filename = document.get_filename()
if filename != None:
open_documents[filename] = {
'filename': filename,
'last_activated': document.get_last_activated()
}
data = {
'open_documents': open_documents,
'recently_opened_documents': self.recently_opened_documents
}
if self.master_document is not None:
data['master_document'] = self.master_document.filename
pickle.dump(data, filehandle) In workspace/workspace.py. The only thing it doesn't do is apply the state when you open Seltzer again, which is... annoying |
Thanks for the request. I can implement it myself, no problem. I think just making the master document persistent has a downside: one can forget that they set it and Setzer will behave seemingly weirdly. But that might be worth it. Also I think this calls for a more general solution: naming lists of files as "projects" and loading them all at once (including master state). |
I was thinking the same thing. Being able to define a "project" would be the best solution I think. Sadly the Python code is beyond my knowledge (but it's very nice, and I can learn a lot from it so thanks!) so I doubt I'll be able to do much. |
This is now fixed in the latest flathub update. |
I use multi-document setups on a daily basis, and thus every project I work on has a master document (with the use of '\input'). For every folder/project I open I have to redo this step each and every time.
Can this be set persistant somehow? My Python isn't super, but I'll check if I can do anything to help
The text was updated successfully, but these errors were encountered: