gnome-schedule r1071 - in trunk: . src
- From: gauteh svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-schedule r1071 - in trunk: . src
- Date: Wed, 6 Feb 2008 19:32:28 +0000 (GMT)
Author: gauteh
Date: Wed Feb 6 19:32:28 2008
New Revision: 1071
URL: http://svn.gnome.org/viewvc/gnome-schedule?rev=1071&view=rev
Log:
* The append and update code in at.py has been updated for the POSIXLY_CORRECT formatted date/time format, and everything should be working again
* All code depending on the 'locale' module has been removed and it is no longer imported.
Modified:
trunk/ChangeLog
trunk/src/at.py
trunk/src/atEditor.py
Modified: trunk/src/at.py
==============================================================================
--- trunk/src/at.py (original)
+++ trunk/src/at.py Wed Feb 6 19:32:28 2008
@@ -100,16 +100,23 @@
if (output == True):
if len (line) > 1 and line[0] != '#':
m = self.atRecordRegex[3].match(line)
- if m != None:
- print m.groups ()
-
+ if m != None:
# Time
- time = m.groups ()[4]
+ time = m.groups ()[4][:-3]
# Date
- date= m.groups ()[5] + "-" + m.groups ()[2] + "-" + m.groups ()[3]
+ day = m.groups ()[3]
+ month = m.groups ()[2]
+
for monthname in self.months:
- date = date.replace (monthname, self.months[monthname])
+ month = month.replace (monthname, self.months[monthname])
+
+ if int (day) < 10:
+ day = "0" + day
+ if int (month) < 10:
+ month = "0" + month
+
+ date = day + "." + month + "." + m.groups ()[5]
job_id = m.groups ()[0]
class_id = m.groups ()[6]
@@ -203,8 +210,8 @@
# print "$" + runat + "$"
#regexp1 = re.compile("([0-9][0-9]):([0-9][0-9])\ ([0-9][0-9])\.([0-9][0-9])\.([0-9][0-9][0-9][0-9])")
#print "Testing: " + runat
- regexp1 = re.compile ("([0-9][0-9]):([0-9][0-9])\ ([0-9][0-9][0-9][0-9])\-([0-9][0-9])\-([0-9][0-9])")
- regexp2 = re.compile("([0-9][0-9]):([0-9][0-9])")
+ regexp1 = re.compile ("([0-9][0-9])([0-9][0-9])\ ([0-9][0-9])\.([0-9][0-9])\.([0-9][0-9][0-9][0-9])")
+ regexp2 = re.compile("([0-9][0-9])([0-9][0-9])")
regexp3 = re.compile("([0-9][0-9])\.([0-9][0-9])\.([0-9][0-9][0-9][0-9])")
runat_g1 = regexp1.match(runat)
@@ -218,7 +225,7 @@
cminute = ctime[4]
if runat_g1:
- (hour, minute, year, month, day) = runat_g1.groups()
+ (hour, minute, day, month, year) = runat_g1.groups()
hour = int(hour)
minute = int(minute)
year = int(year)
@@ -324,7 +331,6 @@
def append (self, runat, command, title):
- print "append"
tmpfile = tempfile.mkstemp ()
fd, path = tmpfile
tmp = os.fdopen(fd, 'w')
@@ -338,20 +344,19 @@
if self.user != "root":
#changes the ownership
os.chown(path, self.uid, self.gid)
- execute = config.getSubin() + " " + self.user + " -c \"" + config.getAtbin() + " " + runat + " -f " + path + " && exit\""
+ execute = config.getSubin() + " " + self.user + " -c \"" + config.getAtbin() + " -f " + path + " " + runat + " && exit\""
child_stdin, child_stdout, child_stderr = os.popen3(execute)
else:
- execute = config.getAtbin() + " " + runat + " -f " + path
+ execute = config.getAtbin() + " -f " + path + " " + runat
child_stdin, child_stdout, child_stderr = os.popen3(execute)
else:
- execute = config.getAtbin() + " " + runat + " -f " + path
+ execute = config.getAtbin() + " -f " + path + " " + runat
child_stdin, child_stdout, child_stderr = os.popen3(execute)
err = child_stderr.readlines ()
job_id = 0
for line in err:
- print line
t = self.parse (line, False)
if t != False:
job_id = t
@@ -393,13 +398,13 @@
if self.user != "root":
#changes the ownership
os.chown(path, self.uid, self.gid)
- execute = config.getSubin() + " " + self.ParentClass.user + " -c \"" + config.getAtbin() + " " + runat + " -f " + path + " && exit\""
+ execute = config.getSubin() + " " + self.user + " -c \"" + config.getAtbin() + " -f " + path + " " + runat + " && exit\""
child_stdin, child_stdout, child_stderr = os.popen3(execute)
else:
- execute = config.getAtbin() + " " + runat + " -f " + path
+ execute = config.getAtbin() + " -f " + path + " " + runat
child_stdin, child_stdout, child_stderr = os.popen3(execute)
else:
- execute = config.getAtbin() + " " + runat + " -f " + path
+ execute = config.getAtbin() + " -f " + path + " " + runat
child_stdin, child_stdout, child_stderr = os.popen3(execute)
err = child_stderr.readlines ()
Modified: trunk/src/atEditor.py
==============================================================================
--- trunk/src/atEditor.py (original)
+++ trunk/src/atEditor.py Wed Feb 6 19:32:28 2008
@@ -206,7 +206,7 @@
#parse
(hour, minute, day, month, year) = self.__parse_time__(self.time, self.date)
- self.runat = hour + ":" + minute + " " + year + "-" + month + "-" + day
+ self.runat = hour + minute + " " + day + "." + month + "." + year
self.spin_year.set_value (int (year))
self.spin_month.set_value (int (month))
self.spin_day.set_value (int (day))
@@ -488,7 +488,7 @@
else:
day = str(day)
- self.runat = hour + ":" + minute + " " + year + "-" + month + "-" + day
+ self.runat = hour + minute + " " + day + "." + month + "." + year
def popup_error_no_digit (self, field):
@@ -510,7 +510,7 @@
hour = ctime[3]
minute = ctime[4]
- self.runat = str(hour) + ":" + str(minute) + " " + str (year) + "-" + str (month) + "-" + str(day)
+ self.runat = str(hour) + str(minute) + " " + str(day) + "." + str(month) + "." + str (year)
self.spin_hour.set_value(int(hour))
self.spin_minute.set_value(int(minute))
@@ -530,7 +530,9 @@
self.text_task_buffer.set_text(self.command)
def __parse_time__ (self, time, date):
- regexp_date = re.compile("([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])")
+ print time
+ print date
+ regexp_date = re.compile("([0-9][0-9])\.([0-9][0-9])\.([0-9][0-9][0-9][0-9])")
regexp_time = re.compile("([0-9][0-9]):([0-9][0-9])")
time_g = regexp_time.match(time)
@@ -539,7 +541,7 @@
date_g = regexp_date.match(date)
if date_g:
- (year, month, day) = date_g.groups()
+ (day, month, year) = date_g.groups()
return hour, minute, day, month, year
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]