Пример #1
0
	def setPriority(self, color):
		if color == 'Custom':
			self.priority = QtGui.QColorDialog.getColor()
		elif color == 'None' or color == 'Choose a Priority':
			self.priority = self.note.background
		else:
			self.priority = color
		if self.priority.isValid():	
			self.eventLabel.setStyleSheet("QWidget { background-color: % s }" % self.priority.name())
			JSONfunctions.convert_all_events(self.note, NotesOnDisplay, NotesOnDisplayJSON)
			JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)
Пример #2
0
	def mouseReleaseEvent(self, event):
		if event.button() == QtCore.Qt.LeftButton:
			self.emit(QtCore.SIGNAL('clicked()'))
		if self.__mousePressPos is not None:
			moved = event.globalPos() - self.__mousePressPos
			self.position = QtGui.QCursor.pos()
			JSONfunctions.update_pos(self, self.rect().topLeft(), NotesOnDisplay, NotesOnDisplayJSON)
			JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)
			if moved.manhattanLength() > 3:
				event.ignore()
				return
Пример #3
0
	def AddEvent(self):
		description = self.enterText.text()
		if description == '':
			self.warning = QtGui.QMessageBox.information(self, 'Warning', 'You must enter a description', QtGui.QMessageBox.Close)
			return
		priority = str(self.prioritySelector.currentText())
		newEvent = Event(self.note, description, priority)
		self.note.events.append(newEvent)
		self.note.displayEvents()
		JSONfunctions.convert_all_events(self.note, NotesOnDisplay, NotesOnDisplayJSON)
		JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)	
		self.accept()
Пример #4
0
	def finishEditAct(self):
		index = self.note.eventLayout.indexOf(self.eventLabel)
		text = self.eventLabel.text()
		if text == '':
			self.delete()
			return
		self.eventLabel.deleteLater()
		self.initLabelUI(text)
		self.description = text
		self.setPriority(self.priority)
		self.note.events[index] = self
		self.createActions()
		self.note.displayEvents()
		JSONfunctions.convert_all_events(self.note, NotesOnDisplay, NotesOnDisplayJSON)
		JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)
Пример #5
0
	def delete(self):
		if len(NotesOnDisplay) == 1:
			index = NotesOnDisplay.index(self)
			del NotesOnDisplayJSON[index]
			del NotesOnDisplay[index]
			self.hide()
			self.deleteLater()
			JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)
			self.exitApp()
		else:
			index = NotesOnDisplay.index(self)
			del NotesOnDisplayJSON[index]
			del NotesOnDisplay[index]
			self.hide()
			self.deleteLater()
			JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)			
Пример #6
0
def main():
	NotesDisplayed = []
	json_data = open('settings.txt')
	data = json.load(json_data)
	GUIClasses.SIZE = data['SIZE']
	GUIClasses.FONTSIZE = data['FONTSIZE']
	NotesToDisplay = data['days']
	app = QtGui.QApplication(sys.argv)
	splash = GUIClasses.QuoteScreen()
	if len(NotesToDisplay) == 0:
		first = GUIClasses.Note()
		first.hide()
	for item in NotesToDisplay:
		new_note = GUIClasses.Note(item['day'], item['position'], item['background'])
		for event in item['events']:
			new_event = GUIClasses.Event(new_note, str(event['description']), JSONfunctions.convert_RGBList_to_Color(event['priority']))
			new_note.events.append(new_event)
			new_note.displayEvents()
		new_note.hide()
		JSONfunctions.convert_all_events(new_note, GUIClasses.NotesOnDisplay, GUIClasses.NotesOnDisplayJSON)
		NotesDisplayed.append(new_note)
	sys.exit(app.exec_())
Пример #7
0
		def callback():
			color = col
			if color == "Custom":
				color = QtGui.QColorDialog.getColor()
			if color.isValid():
				for event in self.events:
					if self.background == event.priority:
						event.priority = color
						event.eventLabel.setStyleSheet("QWidget { background-color: % s }" % color.name())				
				self.background = color
				self.repaint()
				JSONfunctions.update_background(self, color, NotesOnDisplay, NotesOnDisplayJSON)
				JSONfunctions.convert_all_events(self, NotesOnDisplay, NotesOnDisplayJSON)
				JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)
				self.setColorChecked()
Пример #8
0
	def delete(self):
		self.eventLabel.deleteLater()
		self.note.events.remove(self)
		self.note.displayEvents()
		JSONfunctions.convert_all_events(self.note, NotesOnDisplay, NotesOnDisplayJSON)
		JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)
Пример #9
0
	def initUI(self):
		global NotesOnDisplay
		# manage widgets
		self.setStyleSheet('QWidget { font-size: %s }' % FONTSIZE)

		# self.todayLabel = QtGui.QLabel(self)
		self.dateLabel = QtGui.QLabel(self)

		if type(self.date) == datetime.date:
			self.dateLabel.setText(self.formatDate(self.date))
			self.date = self.formatDate(self.date)
		else:
			self.dateLabel.setText(self.date)

		self.dateLabel.setStyleSheet('QWidget {font-size:8pt }')

		self.deleteLabel = ClickableQLabel(self)
		self.deleteLabel.setText('Delete Event')
		self.addLabel = ClickableQLabel(self)
		self.addLabel.setText('Add')

		self.deleteLabel.setStyleSheet('QWidget {font-size:8pt }')
		self.addLabel.setStyleSheet('QWidget {font-size:8pt }')

		#manage signal/slot connections
		self.connect(self, QtCore.SIGNAL('clicked()'), self.focus)
		self.connect(self, QtCore.SIGNAL('doubleClicked()'), self.addEvent)
		self.connect(self.deleteLabel, QtCore.SIGNAL('clicked()'), self.deleteEvent)
		self.connect(self.addLabel, QtCore.SIGNAL('clicked()'), self.addEvent)

		# manage layouts
		self.dateLayout = QtGui.QHBoxLayout()
		self.dateLayout.addStretch(1)
		self.dateLayout.addWidget(self.dateLabel)

		self.eventLayout = QtGui.QVBoxLayout()
		for item in self.events:
			self.eventLayout.addWidget(item.getDescription())
		self.eventLayout.addStretch(1)

		self.editLayout = QtGui.QHBoxLayout()
		self.editLayout.addWidget(self.deleteLabel)
		self.editLayout.addStretch(1)
		self.editLayout.addWidget(self.addLabel)

		self.mainLayout = QtGui.QVBoxLayout()
		self.mainLayout.addLayout(self.dateLayout)
		self.mainLayout.addLayout(self.eventLayout)
		self.mainLayout.addStretch(1)
		self.mainLayout.addLayout(self.editLayout)

		self.setLayout(self.mainLayout)
		self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
		self.resize(self.WIDTH, self.HEIGHT)
		self.move(self.position)
		self.show()

		#initialize actions and shortcuts
		self.createActions()
		QtGui.QShortcut(QtGui.QKeySequence('Ctrl+N'), self, self.openNewNote)
		QtGui.QShortcut(QtGui.QKeySequence('Ctrl+A'), self, self.addEvent)
		QtGui.QShortcut(QtGui.QKeySequence('Ctrl+W'), self, self.delete)
		QtGui.QShortcut(QtGui.QKeySequence('F1'), self, self.changeColor(KHAKI))
		QtGui.QShortcut(QtGui.QKeySequence('Ctrl+Q'), self, self.exitApp)
		QtGui.QShortcut(QtGui.QKeySequence('F2'), self, self.changeColor(PINK))
		QtGui.QShortcut(QtGui.QKeySequence('F3'), self, self.changeColor(GREEN))
		QtGui.QShortcut(QtGui.QKeySequence('F4'), self, self.changeColor(ORANGE))
		QtGui.QShortcut(QtGui.QKeySequence('F5'), self, self.changeColor(PURPLE))
		QtGui.QShortcut(QtGui.QKeySequence('F6'), self, self.changeColor('Custom'))
		QtGui.QShortcut(QtGui.QKeySequence('Del'), self, self.deleteEvent)


		NotesOnDisplay.append(self)
		NotesOnDisplayJSON.append(JSONfunctions.convert_note_to_dict(self))
		JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)
Пример #10
0
	def exitApp(self):
		JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)		
		sys.exit()
Пример #11
0
		def callback():
			global FONTSIZE
			FONTSIZE = size
			self.setStyleSheet('QWidget {font-size: %s }' % FONTSIZE)
			JSONfunctions.save(NotesOnDisplayJSON, SIZE, FONTSIZE)
			self.setFontChecked()