-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ui dev #1
Open
zeweima
wants to merge
81
commits into
master
Choose a base branch
from
ui-dev
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
增加了DDL列表
main logo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
-- coding: utf-8 --
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from time import time,localtime,strftime
from datetime import datetime
from datetime import timedelta
from calendar import monthrange
from functools import partial
import os
import os.path
import time
from get_class import *
FontSize = 10
FontType = "SimHei"
RowHeight = 90
ColWidth = 100
pic_dir = "./pic/"
reload(sys)
sys.setdefaultencoding('utf8')
def transDate(date):
[year, month, day] = date.split('-')
s = month + u'月' + day + u'日 ' + year
return s
def details(ID):
f = open(r"data/root/0_time_routine_ls", 'r')
lists = f.readlines()
f.close()
flag = False
_list = []
for i in range(len(lists)):
lists[i] = lists[i].replace('\n', '')
temp_list = lists[i].split(' ')
#print temp_list, ID
#print temp_list[0], ID
if ID == temp_list[0]:
filename_list = temp_list[2].split('-')
filename = temp_list[0] + '$$'+filename_list[0]+'-'+filename_list[1]+'-'+filename_list[2] + '$$' + filename_list[3]
flag = True
if flag:
path = 'data/list/' + filename
notepath = 'data/note/' + ID
if os.path.isfile(path):
f = open(path, 'r')
f_notepath = open(notepath,'r')
note = f_notepath.read()
_list = f.readlines()
for i in range(len(_list)):
_list[i] = _list[i].replace('\n', '')
_list.append(note)
return _list
else:
return _list
def getlist():
f = open(r"data/root/0_time_routine_ls", 'r')
lists = f.readlines()
f.close()
for i in range(lists.len()):
lists[i] = lists[i].replace('\n', '')
del lists[0]
del lists[0]
#print lists
return lists
def get_tag_list(tag):
def getTagList():
f = open(r"data/root/tags", 'r')
tags = []
for n, line in enumerate(f):
if n == 0:
pass
else:
tags.append(line.strip())
return tags
def getcompletelist():
full_list = []
lists = getlist()
for i in range(lists.len()):
temp = lists[i].split(' ')
temp_list = details(temp[0])
full_list.append(temp_list)
return full_list
def tranBoolList(aList):
a = aList.replace('False', '0').replace('True', '1')
a = a[1:-1].split(', ')
return a
def remove(ID):
detail = details(ID)
tags = detail[8].split(',')
for i in range(5):
tags[i] = tags[i].decode('utf-8')
k = -1
_tag_list = []
for i in range(5):
if not tags[i] == '':
tag_path = u'data/root/'.encode('utf-8') + tags[i].encode('utf-8')
f = open(tag_path.decode('utf-8').encode('gbk'), 'r')
tag_list = f.readlines()
f.close()
for j in tag_list[::-1]:
_tag_list.append(tag_list[j].replace('\n',''))
tag_temp = _tag_list[j].split(' ')
if ID == tag_temp[0]:
del tag_list[k]
if len(tag_list):
f = open(tag_path.decode('utf-8').encode('gbk'), 'w')
print tag_list
f.writelines(tag_list)
f.close()
else:
f = open(r"data/root/tags", 'r')
os.remove(tag_path.decode('utf-8').encode('gbk'))
tag_lists = f.readlines()
f.close()
for h in range(len(tag_lists)):
if tags[i] == tag_lists[h].replace('\n', '').decode('utf-8'):
del tag_lists[h]
f = open(r"data/root/tags", 'w')
f.writelines(tag_lists)
time_list = detail[4].split(' ')
filename = ID +'$$' +time_list[0]+'$$'+time_list[1]
f = open(r"data/root/0_time_routine_ls", 'r')
lists = f.readlines()
f.close()
_lists = []
lenth = len(lists)
for i in range(0, len(lists))[::-1]:
_lists.append(lists[i].replace('\n', ''))
temp_list = _lists[lenth-1-i].split(' ')
if ID == temp_list[0]:
path = 'data/list/' + filename
os.remove(path)
del lists[i]
notepath = 'data/note/' + ID
os.remove(notepath)
def filter(s):
date = s.split()
month = date[-3].replace('月', '')
weekdays = {'周一': 1, '周二': 2, '周三': 3, '周四': 4, '周五': 5, '周六': 6, '周日': 7}
months = {'一': 1,'二': 2,'三': 3,'四': 4,'五': 5,'六': 6,'七': 7,'八': 8,'九': 9,'十': 10,'十一': 11,'十二': 12}
weekday = weekdays[date[0]]
month = months[month]
date = date[-1] + '-' + str(month) + '-' + date[-2]
#date_weekday = date + '-' + str(weekday)
# print date
# print date_weekday
return date
class RepeatWindow(QDialog): # 勾选重复按钮后,弹出的重复设置
def init(self):
super(RepeatWindow, self).init()
self.setWindowTitle(u"重复")
self.setModal(True)
self.initLayout()
self.resize(300, 100)
self.rejectFlag = 0
self.show()
class CalendarWindow(QDialog): # 日历选择控件
def init(self, x, y, printDate):
super(CalendarWindow, self).init()
self.printDate = printDate
self.setModal(True)
self.layout = QGridLayout(self)
self.setWindowFlags(Qt.FramelessWindowHint)
self.showCalendar()
self.layout.addWidget(self.cal, 0, 0)
self.move(x, y)
self.date = ""
self.show()
class calendarLineEdit(QLineEdit): # 点击会出现日历选择的编辑条
def init(self, x, y):
super(calendarLineEdit, self).init()
self.setWindowTitle("Talendar")
self.x = x
self.y = y
class Add(QDialog): # 新建事项窗口
def init(self):
super(Add, self).init()
self.setWindowTitle(u"新建")
self.setWindowFlags(Qt.WindowMinimizeButtonHint)
self.setModal(True)
self.initLayout()
self.setFixedSize(500, 500)
# self.setFixedSize(self.width(), self.height())
self.show()
class Show(Add):
def init(self, id):
super(Show, self).init()
self.setWindowTitle(u"详细信息")
self.id = str(id)
#print self.id
self.btnDelete = QPushButton(u'删除')
self.btnDelete.clicked.connect(self.DeleteItem)
self.bottomLayout.addWidget(self.btnDelete, 3, 3)
self.showInfo(details(self.id))
self.buttonSon.setText(u"显示子事件")
if self.sonIDList =="":
self.buttonSon.setEnabled(False)
def newDDL(self):
addWindow = DDL()
if addWindow.exec_():
return
class otherTag(QDialog):
def init(self):
super(otherTag, self).init()
self.initLayout()
self.setWindowTitle(u'其他标签')
self.show()
def initLayout(self):
self.layout = QVBoxLayout(self)
self.lblInfo = QLabel(u'请输入希望查找的标签:')
self.edit = QLineEdit()
self.layout.addWidget(self.lblInfo)
self.layout.addWidget(self.edit)
#buttonsOkCancel = QDialogButtonBox(
# QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
# Qt.Horizontal, self)
#buttonsOkCancel.accepted.connect(self.accept)
#buttonsOkCancel.rejected.connect(self.reject)
self.btnYes = QPushButton(u'确定')
self.layout.addWidget(self.btnYes)
self.btnYes.clicked.connect(self.check)
def check(self):
tag = self.edit.text()
tagList = getTagList()
#print unicode(tagList[0]), unicode(tagList[1])
#print tag
if unicode(tag) in tagList:
self.accept()
self.tag = tag
else:
QMessageBox.warning(self, u'警告', u'无包含此标签的事项',
QMessageBox.Yes, QMessageBox.Yes)
class multiItem(QDialog):
def init(self, IDs):
super(multiItem, self).init()
self.IDs = IDs
class Talendar(QWidget): # 主界面
def main():
app = QApplication(sys.argv)
#mainPage = MainPage()
talendar = Talendar()
talendar.show()
sys.exit(app.exec_())
if name == 'main':
main()