[Dextrose] [PATCH] Adding lease detail in Mycomputer Section
Anish Mangal
anishmangal2002 at gmail.com
Wed Feb 2 11:05:16 EST 2011
Hi Mohit,
Were you also working on a patch that notifies the user when the lease
is about to expire?
On Mon, Jan 17, 2011 at 16:08, nagpal <nagpal at localhost.localdomain> wrote:
>
> Signed-off-by: nagpal <nagpal at localhost.localdomain>
> ---
> extensions/cpsection/aboutcomputer/model.py | 15 ++++++++++++++-
> extensions/cpsection/aboutcomputer/view.py | 20 +++++++++++++++++++-
> 2 files changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/extensions/cpsection/aboutcomputer/model.py b/extensions/cpsection/aboutcomputer/model.py
> index e3b9687..9a8b59f 100644
> --- a/extensions/cpsection/aboutcomputer/model.py
> +++ b/extensions/cpsection/aboutcomputer/model.py
> @@ -14,7 +14,7 @@
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> #
> -
> +from datetime import datetime
> import os
> import logging
> import re
> @@ -38,6 +38,19 @@ def get_aboutcomputer():
> def print_aboutcomputer():
> print get_aboutcomputer()
>
> +def get_lease_days():
> + lines = _read_file('/usr/share/sugar/extensions/cpsection/aboutcomputer/lease.sig')
> + listt = str.split(lines)
> + word = str(listt[3])
> + d = datetime.strptime(word,"%Y%m%dT%H%M%SZ")
> + t = datetime.today()
> + k = (d-t).days
> + p = str(k)+'days'
> + return p
> +
> +
> +
> +
>
> def get_serial_number():
> serial_no = _read_file('/ofw/serial-number')
> diff --git a/extensions/cpsection/aboutcomputer/view.py b/extensions/cpsection/aboutcomputer/view.py
> index 7892577..3c7d237 100644
> --- a/extensions/cpsection/aboutcomputer/view.py
> +++ b/extensions/cpsection/aboutcomputer/view.py
> @@ -15,7 +15,7 @@
> # You should have received a copy of the GNU General Public License
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> -
> +
> import os
> from gettext import gettext as _
>
> @@ -127,6 +127,24 @@ class AboutComputer(SectionView):
> box_software.pack_start(box_sugar, expand=False)
> box_sugar.show()
>
> + box_lease = gtk.HBox(spacing=style.DEFAULT_SPACING)
> + label_lease = gtk.Label(_('Lease:'))
> + label_lease.set_alignment(1, 0)
> + label_lease.modify_fg(gtk.STATE_NORMAL,
> + style.COLOR_SELECTION_GREY.get_gdk_color())
> + box_lease.pack_start(label_lease, expand=False)
> + self._group.add_widget(label_lease)
> + label_lease.show()
> + label_lease_ver = gtk.Label(self._model.get_lease_days())
> + label_lease_ver.set_alignment(0, 0)
> + box_lease.pack_start(label_lease_ver, expand=False)
> + label_lease_ver.show()
> + box_software.pack_start(box_lease, expand=False)
> + box_lease.show()
> +
> +
> +
> +
> if os.path.exists('/ofw'):
> box_firmware = gtk.HBox(spacing=style.DEFAULT_SPACING)
> label_firmware = gtk.Label(_('Firmware:'))
> --
> 1.7.2.3
>
>
--
Anish
More information about the Dextrose
mailing list