示例#1
0
 def serialize(self):
     """
     Converts the object to a serialized tuple of data
     """
     if self.note == None:
         self.note = Note()
     return self.note.serialize()
示例#2
0
    def set_note(self, text):
        """
        Assigns the specified text to the associated note.

        @param text: Text of the note
        @type text: str
        """
        if not self.note:
            self.note = Note()
        self.note.set(text)
示例#3
0
文件: note.py 项目: fjeg/notes
def main(args):

    n = Note(
            note_text = args['--message'],
            tag_string = args['--tags'],
            note_name = args['--name']
            )

    if not args['--message']:
        n.note_text_from_editor()

    n.write_note_file()
    print('Wrote the note to {0}'.format(n.note_path))
示例#4
0
    def __init__(self, source=None):
        """
        Create a new NoteBase, copying from source if not None
        
        @param source: Object used to initialize the new object
        @type source: NoteBase
        """

        if source and source.note:
            text = source.note.get()
        else:
            text = ""
        self.note = Note(text)
示例#5
0
 def serialize(self):
     """
     Converts the object to a serialized tuple of data
     """
     if self.note == None:
         self.note = Note()
     return self.note.serialize()
示例#6
0
    def set_note(self, text):
        """
        Assigns the specified text to the associated note.

        @param text: Text of the note
        @type text: str
        """
        if not self.note:
            self.note = Note()
        self.note.set(text)
示例#7
0
 def __init__(self):
     """creates a new Source instance"""
     PrimaryObject.__init__(self)
     MediaBase.__init__(self)
     NoteBase.__init__(self)
     self.title = ""
     self.author = ""
     self.pubinfo = ""
     self.note = Note()
     self.datamap = {}
     self.abbrev = ""
     self.reporef_list = []
示例#8
0
 def __init__(self, source=None):
     """
     Create a new NoteBase, copying from source if not None
     
     @param source: Object used to initialize the new object
     @type source: NoteBase
     """
     
     if source and source.note:
         text = source.note.get()
     else:
         text = ""
     self.note = Note(text)
示例#9
0
 def unserialize(self, data):
     """
     Converts a serialized tuple of data to an object
     """
     if data is not None:
         self.note = Note().unserialize(data)
示例#10
0
class NoteBase:
    """
    Base class for storing notes.
    """
    def __init__(self, source=None):
        """
        Create a new NoteBase, copying from source if not None
        
        @param source: Object used to initialize the new object
        @type source: NoteBase
        """

        if source and source.note:
            text = source.note.get()
        else:
            text = ""
        self.note = Note(text)

    def serialize(self):
        """
        Converts the object to a serialized tuple of data
        """
        if self.note == None:
            self.note = Note()
        return self.note.serialize()

    def unserialize(self, data):
        """
        Converts a serialized tuple of data to an object
        """
        if data is not None:
            self.note = Note().unserialize(data)

    def set_note(self, text):
        """
        Assigns the specified text to the associated note.

        @param text: Text of the note
        @type text: str
        """
        if not self.note:
            self.note = Note()
        self.note.set(text)

    def get_note(self):
        """
        Returns the text of the current note.

        @returns: the text of the current note
        @rtype: str
        """
        if self.note:
            return self.note.get()
        return ""

    def set_note_format(self, val):
        """
        Sets the note's format to the given value. The format indicates
        whether the text is flowed (wrapped) or preformatted.

        @param val: True indicates the text is flowed
        @type val: bool
        """
        if self.note:
            self.note.set_format(val)

    def get_note_format(self):
        """
        Returns the current note's format

        @returns: True indicates that the note should be flowed (wrapped)
        @rtype: bool
        """
        if self.note == None:
            return False
        else:
            return self.note.get_format()

    def set_note_object(self, note_obj):
        """
        Replaces the current L{Note} object associated with the object

        @param note_obj: New L{Note} object to be assigned
        @type note_obj: L{Note}
        """
        self.note = note_obj

    def get_note_object(self):
        """
        Returns the L{Note} instance associated with the object.

        @returns: L{Note} object assocated with the object
        @rtype: L{Note}
        """
        return self.note

    def unique_note(self):
        """Creates a unique instance of the current note"""
        self.note = Note(self.note.get())
示例#11
0
 def unique_note(self):
     """Creates a unique instance of the current note"""
     self.note = Note(self.note.get())
示例#12
0
 def unserialize(self, data):
     """
     Converts a serialized tuple of data to an object
     """
     if data is not None:
         self.note = Note().unserialize(data)
示例#13
0
class NoteBase:
    """
    Base class for storing notes.
    """
    def __init__(self, source=None):
        """
        Create a new NoteBase, copying from source if not None
        
        @param source: Object used to initialize the new object
        @type source: NoteBase
        """
        
        if source and source.note:
            text = source.note.get()
        else:
            text = ""
        self.note = Note(text)

    def serialize(self):
        """
        Converts the object to a serialized tuple of data
        """
        if self.note == None:
            self.note = Note()
        return self.note.serialize()

    def unserialize(self, data):
        """
        Converts a serialized tuple of data to an object
        """
        if data is not None:
            self.note = Note().unserialize(data)

    def set_note(self, text):
        """
        Assigns the specified text to the associated note.

        @param text: Text of the note
        @type text: str
        """
        if not self.note:
            self.note = Note()
        self.note.set(text)

    def get_note(self):
        """
        Returns the text of the current note.

        @returns: the text of the current note
        @rtype: str
        """
        if self.note:
            return self.note.get()
        return ""

    def set_note_format(self, val):
        """
        Sets the note's format to the given value. The format indicates
        whether the text is flowed (wrapped) or preformatted.

        @param val: True indicates the text is flowed
        @type val: bool
        """
        if self.note:
            self.note.set_format(val)

    def get_note_format(self):
        """
        Returns the current note's format

        @returns: True indicates that the note should be flowed (wrapped)
        @rtype: bool
        """
        if self.note == None:
            return False
        else:
            return self.note.get_format()

    def set_note_object(self, note_obj):
        """
        Replaces the current L{Note} object associated with the object

        @param note_obj: New L{Note} object to be assigned
        @type note_obj: L{Note}
        """
        self.note = note_obj

    def get_note_object(self):
        """
        Returns the L{Note} instance associated with the object.

        @returns: L{Note} object assocated with the object
        @rtype: L{Note}
        """
        return self.note

    def unique_note(self):
        """Creates a unique instance of the current note"""
        self.note = Note(self.note.get())
示例#14
0
 def unique_note(self):
     """Creates a unique instance of the current note"""
     self.note = Note(self.note.get())