| 
														
															@@ -51,7 +51,7 @@ class DataBase: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		 
														 | 
														
														 | 
														
															 		 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	def getData(self, fileName): 
														 | 
														
														 | 
														
															 	def getData(self, fileName): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		c = self.db.cursor() 
														 | 
														
														 | 
														
															 		c = self.db.cursor() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		c.execute("select * from dirnotes where name=?",(fileName,)) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		c.execute("select * from dirnotes where name=? order by comment_date desc",(os.path.abspath(fileName),)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		return c.fetchone() 
														 | 
														
														 | 
														
															 		return c.fetchone() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	def setData(self, fileName, _date, _size, comment): 
														 | 
														
														 | 
														
															 	def setData(self, fileName, _date, _size, comment): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		c = self.db.cursor() 
														 | 
														
														 | 
														
															 		c = self.db.cursor() 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -119,11 +119,13 @@ class DirNotes(QMainWindow): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		''' 
														 | 
														
														 | 
														
															 		''' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	def __init__(self, filename, db, parent=None): 
														 | 
														
														 | 
														
															 	def __init__(self, filename, db, parent=None): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		super(DirNotes,self).__init__(parent) 
														 | 
														
														 | 
														
															 		super(DirNotes,self).__init__(parent) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		self.db = db 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		win = QWidget() 
														 | 
														
														 | 
														
															 		win = QWidget() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		self.setCentralWidget(win) 
														 | 
														
														 | 
														
															 		self.setCentralWidget(win) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		self.db = db 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		lb = QTableWidget() 
														 | 
														
														 | 
														
															 		lb = QTableWidget() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		self.lb = lb 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		lb.setColumnCount(2) 
														 | 
														
														 | 
														
															 		lb.setColumnCount(2) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		lb.horizontalHeader().setResizeMode( 1, QHeaderView.Stretch ); 
														 | 
														
														 | 
														
															 		lb.horizontalHeader().setResizeMode( 1, QHeaderView.Stretch ); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		lb.verticalHeader().setDefaultSectionSize(20);	# thinner rows 
														 | 
														
														 | 
														
															 		lb.verticalHeader().setDefaultSectionSize(20);	# thinner rows 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -159,12 +161,22 @@ class DirNotes(QMainWindow): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		e = QLabel("View and edit file comments stored in extended attributes user.xdg.comment") 
														 | 
														
														 | 
														
															 		e = QLabel("View and edit file comments stored in extended attributes user.xdg.comment") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		b1 = QPushButton("restore from database") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		dirLeft = QFileDialog(self,"",current) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		dirLeft.setMaximumHeight(250) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		dirLeft.setOption(QFileDialog.DontUseNativeDialog) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		dirLeft.setFileMode(QFileDialog.Directory) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		dirLeft.setOption(QFileDialog.ShowDirsOnly) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		layout = QVBoxLayout() 
														 | 
														
														 | 
														
															 		layout = QVBoxLayout() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		layout.addWidget(e) 
														 | 
														
														 | 
														
															 		layout.addWidget(e) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		layout.addWidget(b1) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		layout.addWidget(dirLeft) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		layout.addWidget(lb) 
														 | 
														
														 | 
														
															 		layout.addWidget(lb) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		win.setLayout(layout) 
														 | 
														
														 | 
														
															 		win.setLayout(layout) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		 
														 | 
														
														 | 
														
															 		 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		lb.itemChanged.connect(self.change) 
														 | 
														
														 | 
														
															 		lb.itemChanged.connect(self.change) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		b1.pressed.connect(self.restore_from_database) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		QShortcut(QKeySequence("Ctrl+Q"), self, self.close)	 
														 | 
														
														 | 
														
															 		QShortcut(QKeySequence("Ctrl+Q"), self, self.close)	 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		self.setWindowTitle("test") 
														 | 
														
														 | 
														
															 		self.setWindowTitle("test") 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -178,7 +190,13 @@ class DirNotes(QMainWindow): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		r = the_file.setComment(str(x.text()))  
														 | 
														
														 | 
														
															 		r = the_file.setComment(str(x.text()))  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		if r: 
														 | 
														
														 | 
														
															 		if r: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			self.db.log(the_file.getName(),x.text()) 
														 | 
														
														 | 
														
															 			self.db.log(the_file.getName(),x.text()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	def restore_from_database(self): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		print("restore from database") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		fileName = str(self.lb.item(self.lb.currentRow(),0).text()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		fo_row = self.db.getData(fileName) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		if len(fo_row)>1: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			comment = fo_row[3] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			print(fileName,fo_row[0],comment) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		 
														 | 
														
														 | 
														
															 		 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 if __name__=="__main__": 
														 | 
														
														 | 
														
															 if __name__=="__main__": 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	p = parse() 
														 | 
														
														 | 
														
															 	p = parse() 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -224,5 +242,20 @@ user.xdg.publisher 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 ''' TODO: also need a way to display-&-restore comments from the database ''' 
														 | 
														
														 | 
														
															 ''' TODO: also need a way to display-&-restore comments from the database ''' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+''' QFileDialog 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	-make my own? 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	-existing one has 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		-history 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		-back button 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		-up button 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		-but we don't need 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			-directory date 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			-icon option 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			-url browser (unless we go network file system) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			-new folder button 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			-file type chooser 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			-text entry box 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			-choose & cancel buttons 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	''' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |