#Boa:Frame:wxFrame1
# -*- coding: utf-8 -*-
#
# hylaPEx, an hylafax client written in python
#
# www.unipex.it/hylapex/
#
# License:
# GNU General Public License (GPL)
# For more info see LICENSE.txt and LICENSE-GPL.txt
#
# Copyright (C) 2004-2006 Unipex s.r.l., All Rights Reserved.
# Via Vittorio Veneto 83/A
# 33050 Gonars (UD) - Italy
# phone 0039 0432 931511 - fax 0039 0432 931378
# www.unipex.it - michele.petrazzo@unipex.it
import wx, time, datetime, wx_util
def create(parent, data):
return wxFrame1(parent, data)
[wxID_WXFRAME1, wxID_WXFRAME1BT_SAVE, wxID_WXFRAME1LBL_COMPANY,
wxID_WXFRAME1LBL_FAX_NUM, wxID_WXFRAME1LBL_PRIORITY,
wxID_WXFRAME1LBL_PRI_DESCR, wxID_WXFRAME1LBL_TITLE, wxID_WXFRAME1LBL_WHEN,
wxID_WXFRAME1LBL_WHEN_DESCR, wxID_WXFRAME1SLD_PRIORITY,
wxID_WXFRAME1SLD_WHEN, wxID_WXFRAME1TXT_COMPANY, wxID_WXFRAME1TXT_FAX_NUM,
] = [wx.NewId() for _init_ctrls in range(13)]
class wxFrame1(wx.Frame):
def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Frame.__init__(self, id=wxID_WXFRAME1, name='', parent=prnt,
pos=wx.Point(386, 327), size=wx.Size(310, 248),
style=wx.DEFAULT_FRAME_STYLE, title='Modify job')
self.SetClientSize(wx.Size(302, 221))
self.SetBackgroundColour(wx.Colour(225, 225, 225))
self.sld_when = wx.Slider(id=wxID_WXFRAME1SLD_WHEN, maxValue=100,
minValue=0, name='sld_when', parent=self, point=wx.Point(72, 56),
size=wx.Size(216, 20), style=wx.SL_HORIZONTAL,
validator=wx.DefaultValidator, value=0)
self.sld_when.SetBackgroundColour(wx.Colour(225, 225, 225))
self.sld_when.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
'MS Shell Dlg'))
self.sld_when.SetToolTipString('')
self.sld_when.Bind(wx.EVT_COMMAND_SCROLL, self.OnSldwhenScroll,
id=wxID_WXFRAME1SLD_WHEN)
self.lbl_when = wx.StaticText(id=wxID_WXFRAME1LBL_WHEN, label='Hour',
name='lbl_when', parent=self, pos=wx.Point(8, 56),
size=wx.Size(17, 13), style=0)
self.lbl_when.SetToolTipString('')
self.lbl_title = wx.StaticText(id=wxID_WXFRAME1LBL_TITLE,
label='Modify fax', name='lbl_title', parent=self,
pos=wx.Point(104, 8), size=wx.Size(101, 22), style=0)
self.lbl_title.SetToolTipString('')
self.lbl_title.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD, False,
'Arial'))
self.lbl_when_descr = wx.StaticText(id=wxID_WXFRAME1LBL_WHEN_DESCR,
label='Now', name='lbl_when_descr', parent=self,
pos=wx.Point(160, 40), size=wx.Size(35, 13), style=0)
self.lbl_when_descr.SetToolTipString('')
self.lbl_priority = wx.StaticText(id=wxID_WXFRAME1LBL_PRIORITY,
label='Priority', name='lbl_priority', parent=self,
pos=wx.Point(8, 88), size=wx.Size(32, 13), style=0)
self.sld_priority = wx.Slider(id=wxID_WXFRAME1SLD_PRIORITY,
maxValue=255, minValue=1, name='sld_priority', parent=self,
point=wx.Point(72, 96), size=wx.Size(216, 20),
style=wx.SL_HORIZONTAL, validator=wx.DefaultValidator, value=0)
self.sld_priority.SetToolTipString('')
self.sld_priority.Bind(wx.EVT_COMMAND_SCROLL,
self.OnSld_priorityCommandScroll, id=wxID_WXFRAME1SLD_PRIORITY)
self.bt_save = wx.Button(id=wxID_WXFRAME1BT_SAVE, label='Salva',
name='bt_save', parent=self, pos=wx.Point(208, 192),
size=wx.Size(75, 24), style=0)
self.bt_save.SetToolTipString('')
self.bt_save.Bind(wx.EVT_BUTTON, self.OnBt_saveButton,
id=wxID_WXFRAME1BT_SAVE)
self.lbl_pri_descr = wx.StaticText(id=wxID_WXFRAME1LBL_PRI_DESCR,
label='127', name='lbl_pri_descr', parent=self, pos=wx.Point(168,
80), size=wx.Size(18, 13), style=0)
self.lbl_pri_descr.SetToolTipString('')
self.txt_fax_num = wx.TextCtrl(id=wxID_WXFRAME1TXT_FAX_NUM,
name='txt_fax_num', parent=self, pos=wx.Point(80, 128),
size=wx.Size(200, 21), style=0, value='')
self.txt_fax_num.SetToolTipString('')
self.lbl_fax_num = wx.StaticText(id=wxID_WXFRAME1LBL_FAX_NUM,
label='Fax number', name='lbl_fax_num', parent=self,
pos=wx.Point(8, 128), size=wx.Size(54, 13), style=0)
self.lbl_fax_num.SetToolTipString('')
self.txt_company = wx.TextCtrl(id=wxID_WXFRAME1TXT_COMPANY,
name='txt_company', parent=self, pos=wx.Point(80, 160),
size=wx.Size(200, 21), style=0, value='')
self.txt_company.SetToolTipString('')
self.lbl_company = wx.StaticText(id=wxID_WXFRAME1LBL_COMPANY,
label='Company', name='lbl_company', parent=self, pos=wx.Point(8,
160), size=wx.Size(48, 13), style=0)
def __init__(self, parent, data):
self._init_ctrls(parent)
self.parent = parent
self.paths = parent.paths
self.txt_fax_num.SetValue(data[0])
self.txt_company.SetValue(data[1])
self.ren = wx_util.rename_ctrls(self, 'modify', self.paths.my_path,
lang = self.paths.language)
self.ren.rename()
self.sld_priority.SetValue(127)
def OnSldwhenScroll(self, event):
now = time.time()
if self.sld_when.GetValue() == 0:
self.lbl_when_descr.SetLabel(self.ren.get('now', 1))
return
val = self.sld_when.GetValue() * 15 * 60 # 15 min jumps
self.timesend = val + now
when = datetime.datetime.fromtimestamp( self.timesend )
self.lbl_when_descr.SetLabel("%s:%s %s/%s" % (when.hour, when.minute, when.day, when.month))
def OnSld_priorityCommandScroll(self, event):
self.lbl_pri_descr.SetLabel(str(self.sld_priority.GetValue()))
def OnBt_saveButton(self, event):
sld = str(self.sld_priority.GetValue())
when = str(self.sld_when.GetValue())
fn = self.txt_fax_num.GetValue()
company = self.txt_company.GetValue()
self.parent.agg_modify( (sld, when, fn, company) )
self.Destroy()
|