git @ Cat's Eye Technologies tideay / 86a391e
Make it not possible to open 2 copies of the same file or watcher. Chris Pressey 9 years ago
2 changed file(s) with 17 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
2020 --------
2121
2222 Ctrl+O open (or create) a file into a buffer
23 Alt+1, Alt+2...Alt+0 switch to buffer #1, #2... #10
2423 Ctrl+W close buffer
2524
2625 Ctrl+I jump to line
187186 ### buffers ###
188187
189188 * **Some way to switch to a buffer by typing in part of its filename.**
190 * Should not be possible to open 2 copies of the same file.
191189 * Should be able to populate buffers from all "interesting" files in the
192190 current directory tree. (repository <=> workspace)
193191 * Some nice way to move/copy a buffer while inside the editor.
302302 self.file_text = ''
303303 self.sync_from_disk()
304304
305 def key(self):
306 return '%s(%s)' % (self.__class__.__name__, self.filename)
307
305308 def on_key_press_event(self, widget, event):
306309 end = self.buffer.get_iter_at_offset(
307310 self.buffer.get_property('cursor-position')
10171020
10181021 # TODO: "buffer" needs a better name. as does "editor"
10191022 def open_buffer(self, editor, label_text):
1023
1024 i = 0
1025 while i < self.notebook.get_n_pages():
1026 item = self.notebook.get_nth_page(i)
1027 if item not in self.editors:
1028 break
1029 if self.editors[item].key() == editor.key():
1030 print "%s already open" % editor.key()
1031 self.select_editor(i)
1032 return
1033 i += 1
1034
10201035 scrolly = gtk.ScrolledWindow()
10211036 scrolly.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
10221037 scrolly.add(editor.view)
10631078 hbox.show_all()
10641079 scrolly.show_all()
10651080
1081 # TODO does this make sense anymore?
10661082 filenames = []
10671083 i = 0
10681084 while i < self.notebook.get_n_pages():
10811097 where = best
10821098
10831099 self.notebook.insert_page(scrolly, hbox, where)
1084 page_number = self.notebook.page_num(scrolly)
1085 self.notebook.set_current_page(page_number)
1100 self.select_editor(self.notebook.page_num(scrolly))
10861101 self.notebook.set_tab_reorderable(scrolly, True)
1087
10881102 self.editors[scrolly] = editor
1089 self.set_window_title(page_number)
10901103
10911104 def active_sourceview(self):
10921105 """Note that this returns a gtksourceview2.View object.