Skip to content

Commit

Permalink
Note list is now populated based on the repolocation (currently hardc…
Browse files Browse the repository at this point in the history
…oded). And double clicking one will open it up in the textview
  • Loading branch information
Lugghawk committed Aug 9, 2011
1 parent 0511781 commit c7262f5
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 19 deletions.
9 changes: 9 additions & 0 deletions src/notes/configuration.py
Expand Up @@ -13,6 +13,8 @@ class Configuration(object):
user_email = ''
user_name = ''

session_note_extension = 'ses' #The extension on the session note

user_note_template = '' #Path of the template used for notes.

template_substitute_list = [] #A list of substitutes when a new note is created.
Expand All @@ -35,5 +37,12 @@ def __init__(self):
This constructor will be called when no configuration file can be found.
'''

def setRepoLocation(self, location):
self.session_note_repo_location = location
return self.session_note_repo_location

def repoLocation(self):
return self.session_note_repo_location



5 changes: 4 additions & 1 deletion src/notes/main.glade
Expand Up @@ -246,10 +246,12 @@
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkTextView" id="textview1">
<object class="GtkTextView" id="noteView">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">5</property>
<property name="editable">False</property>
<property name="buffer">noteBuffer</property>
</object>
</child>
</object>
Expand Down Expand Up @@ -316,4 +318,5 @@
</object>
</child>
</object>
<object class="GtkTextBuffer" id="noteBuffer"/>
</interface>
6 changes: 4 additions & 2 deletions src/notes/main.py
Expand Up @@ -4,7 +4,7 @@
@author: Lugghawk and jenn0108
'''

import os, mypygit,sys, ui
import os, mypygit,sys, ui,configuration

'''homedir = os.path.expanduser("~")
repodir = os.path.normcase(homedir+"/sessionnotes/")
Expand All @@ -26,7 +26,9 @@
except:
sys.exit(1)

myUI = ui.UI()
config = configuration.Configuration()
config.setRepoLocation(os.path.normcase ("C:/SessionNotes/repo"))
myUI = ui.UI(config)
gtk.main()


65 changes: 49 additions & 16 deletions src/notes/ui.py
Expand Up @@ -6,7 +6,7 @@
http://matgnt.wordpress.com/2009/11/08/eclipse-pydev-and-gtk-with-code-completion/
'''

import sys
import sys,configuration, os

try:
import pygtk
Expand Down Expand Up @@ -34,28 +34,61 @@ def get_note_name(self, treeView, path):
return treeView.get_selection().get_selected_rows()[0][path[0]][0]

def show_highlighted_note(self, treeview, path, view_column, userData=None):
print self.get_note_name(treeview,path)
noteBuffer = self.builder.get_object("noteBuffer")
# print self.list_object_names()
note = open (self.configFile.repoLocation()+"\\" + str(self.get_note_name(treeview,path)) )

noteBuffer.set_text(note.read())

def list_object_names(self):
objects = self.builder.get_objects()
for stuff in objects:
print stuff

def __init__(self):
def __init__(self, config):
#Set the gladefile
filename = "main.glade"
builder = gtk.Builder()
builder.add_from_file(filename)
self.builder = gtk.Builder()
self.builder.add_from_file(filename)

self.configFile = config
self.listNotes = []
self.createNoteList(self.configFile.repoLocation())

self.window = self.builder.get_object("window1")

self.noteList = self.builder.get_object("noteList")

self.window = builder.get_object("window1")
testList = [['Daves Note','Dave Lugg'],['Daves Note 2','Dave Lugg']]
self.noteList = builder.get_object("noteList")
for nodes in testList:
for nodes in self.listNotes:
self.noteList.append(nodes)
pass

builder.connect_signals(self)

self.builder.connect_signals(self)

def createNoteList(self,repoLocation):
'''
This method will create a list within a list of [Note Filename],[Author] pairs of each of the notes within the repository.
'''
dir = os.listdir(repoLocation)
for fname in dir:
if fname[-3:] == self.configFile.session_note_extension:
self.listNotes.append([fname, self.getNoteAuthor(fname)])

def getNoteAuthor(self, noteName):
'''
Currently this will spread out the initials used in the session note filename.
This should be extended to take the template into account
'''
authInitials = noteName.split("-")[1]
newInitials = ''
authInitials = authInitials.upper()
for chars in authInitials:
newInitials += chars +"."

return newInitials







if __name__ == '__main__':
app = UI()
gtk.main()

0 comments on commit c7262f5

Please sign in to comment.