Commit 01974215 authored by Cage, Marshall Andrew's avatar Cage, Marshall Andrew
Browse files

Update Time context to match Date context

parent 05f17863
......@@ -250,10 +250,6 @@ class Package():
m.setupUi()
return m
# except:
# print("Unable to load plugin %s" %path)
# return None
class Plugin():
def __init__(self,name="None",package=None):
......@@ -413,8 +409,6 @@ class DateContext(Context):
self.ui.checkEnd.stateChanged.connect(self.updateEnd)
self.ui.dateEnd.dateChanged.connect(self.updateEnd)
print(self.getMonth("Name"))
def getWidget(self):
return self.widget
......@@ -503,6 +497,8 @@ class TimeContext(Context):
dateTime = QDateTime.currentDateTime()
self.begin = dateTime.time()
self.end = dateTime.time()
self.hasBegin = False
self.hasEnd = False
from ui.timecontextwidget import Ui_TimeContextWidget
self.ui = Ui_TimeContextWidget()
......@@ -516,8 +512,8 @@ class TimeContext(Context):
self.ui.timeBegin.timeChanged.connect(self.updateBegin)
self.ui.checkEnd.stateChanged.connect(self.updateEnd)
self.ui.timeEnd.timeChanged.connect(self.updateEnd)
self.updateBegin()
self.updateEnd()
# self.updateBegin()
# self.updateEnd()
def getWidget(self):
return self.widget
......@@ -560,6 +556,40 @@ class TimeContext(Context):
return valid
# Access
def getBegin(self,format=None):
if self.hasBegin:
return self.begin if not format else self.begin.toString(format)
def getEnd(self,format=None):
if self.hasEnd:
return self.end if not format else self.end.toString(format)
def getMinute(self,format):
ct = QTime.currentTime()
return {
"long" : ct.toString("mm"),
"short" : ct.toString("m"),
}[format.lower()]
def getHour(self,format):
ct = QTime.currentTime()
return {
"long" : ct.toString("hh"),
"short" : ct.toString("h"),
}[format.lower()]
def getSecond(self,format):
ct = QTime.currentTime()
return {
"long" : ct.toString("ss"),
"short" : ct.toString("s"),
"precise" : ct.toString("ss.zzz"),
}[format.lower()]
def toString(self,format):
return QTime.currentTime().toString(format)
def PackOptions(opts):
pack = ''
for k in opts:
......
......@@ -239,7 +239,7 @@ class ARCTool(QMainWindow):
if self.removeDialog.buttonRole(b) == QMessageBox.YesRole:
self.profile.removeSection()
def setIsSaved(self,saved):
def setIsSaved(self,saved=True):
self.isSaved = saved
def newProfile(self):
......@@ -264,7 +264,7 @@ class ARCTool(QMainWindow):
self.setContext('None')
self.profile.setListWidget(self.ui.sectionList)
self.ui.profileName.setText(self.profile.getName())
self.setIsSaved(True)
self.setIsSaved()
self.updateTitle()
self.updatePluginTools()
......@@ -450,9 +450,10 @@ class ARCTool(QMainWindow):
self.ui.profileName.setText(self.profile.getName())
self.ui.sectionList.setCurrentRow(0)
self.updatePluginTools()
self.setIsSaved(True)
self.setIsSaved()
self.updateTitle()
'''Save profiles to disk. The format is a loose markup language.'''
def saveProfile(self,saveAs=False):
name = self.profile.getName().replace(' ', '_') + ".arp"
path = None
......@@ -487,7 +488,7 @@ class ARCTool(QMainWindow):
data = "<profile name=\"%s\" sections=%d>\n\t%s</profile>\n"\
%(self.profile.getName(),len(toc[1]),data)
file.write(data)
self.setIsSaved(True)
self.setIsSaved()
self.updateTitle()
self.ui.statusBar.showMessage("Saved Profile as %s" %name)
return 0
......
......@@ -423,6 +423,11 @@ class Plugin(arcclasses.Plugin):
def stripPleasantries(self,text):
return text
# Pleasantries are currently being stripped just based on the length
# of the block they're in. This can be inaccurate tho, so the bellow
# code was supposed to look at the derivative of the line lengths and
# use maxima/minima to determine leading and trailing blocks and then
# remove those. It doesn't work. Something to do with the tag stripping
# deltas = []
# blocks = re.split('<br/?>',text)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment