Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added some UI elements

  • Loading branch information...
commit adfefbf27f21c9123e8d4d95de62de4b4945cdce 1 parent cddea0c
@Lugghawk authored
Showing with 375 additions and 0 deletions.
  1. +28 −0 src/notes/configuration.py
  2. +288 −0 src/notes/main.glade
  3. +59 −0 src/notes/ui.py
View
28 src/notes/configuration.py
@@ -0,0 +1,28 @@
+'''
+Created on 2011-08-02
+
+@author: dl250074
+'''
+
+class Configuration(object):
+ '''
+ This class will hold all the configuration parameters used by the program.
+ Things like repo directories, template locations, and in-template substitutes.
+
+ '''
+ user_email = ''
+ user_name = ''
+ user_note_template = ''
+ text_editor_location = '' # Will probably involve another subprocess call. Need to let the user know that their text editor should support a command line opening of files.
+ # This is the editor the user will be using to open notes with.
+ # We would like to be able to have the user open the notes by double clicking on them in the list
+
+
+
+ def __init__(self):
+ '''
+ This constructor will be called when no configuration file can be found.
+ '''
+
+
+
View
288 src/notes/main.glade
@@ -0,0 +1,288 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkListStore" id="noteList">
+ <columns>
+ <!-- column-name NoteName -->
+ <column type="gchararray"/>
+ <!-- column-name CreatorName -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkWindow" id="mainWindow">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">Test Window</property>
+ <property name="default_width">600</property>
+ <property name="default_height">400</property>
+ <signal name="destroy" handler="on_mainWindow_destroy"/>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTreeView" id="noteListView">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">5</property>
+ <property name="model">noteList</property>
+ <property name="headers_clickable">False</property>
+ <property name="enable_tree_lines">True</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="title">Notes</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="noteNameText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <property name="title">Creator</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="creatorNameText"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">10</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="spacing">20</property>
+ <property name="layout_style">center</property>
+ <child>
+ <object class="GtkButton" id="refreshButton">
+ <property name="label" translatable="yes">Refresh Notes</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="show_selectednote"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="newNoteButton">
+ <property name="label" translatable="yes">New Note</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox6">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="extension_events">all</property>
+ <property name="label" translatable="yes">E-mail: </property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="userEmailLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Not Set!</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Name: </property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="usernameLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Not Set!</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTextView" id="textview1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">5</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkButton" id="configureButton">
+ <property name="label" translatable="yes">Configure...</property>
+ <property name="width_request">75</property>
+ <property name="height_request">30</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">10</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkStatusbar" id="statusbar1">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
View
59 src/notes/ui.py
@@ -0,0 +1,59 @@
+'''
+Created on 2011-08-04
+
+@author: dl250074
+
+http://matgnt.wordpress.com/2009/11/08/eclipse-pydev-and-gtk-with-code-completion/
+'''
+
+import sys
+
+try:
+ import pygtk
+ pygtk.require("2.0")
+except:
+ pass
+
+try:
+ import gtk
+ import gtk.glade
+except:
+ sys.exit(1)
+
+class UI:
+
+
+ def on_mainWindow_destroy (self,widget,data=None):
+ gtk.main_quit()
+
+ def row_selected(self,widget,data=None):
+ self.noteList.clear()
+
+ def show_selectednote(self,widget,data=None):
+ print self.selectedNote.get_selected()
+
+
+
+ def __init__(self):
+ #Set the gladefile
+ filename = "main.glade"
+ builder = gtk.Builder()
+ builder.add_from_file(filename)
+
+ 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:
+ self.noteList.append(nodes)
+
+ builder.connect_signals(self)
+
+ self.selectedNote = builder.get_object("noteListView").get_selection()
+
+
+
+
+
+if __name__ == '__main__':
+ app = UI()
+ gtk.main()
Please sign in to comment.
Something went wrong with that request. Please try again.