def __init__(self, parent, conf, giface=None, id=wx.ID_ANY, title=_("Modify the configuration file"), style=wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER, **kwargs): # VARIABLES self.parent = parent self.rlipath = retRLiPath() self.confile = conf self.pathfile = os.path.join(self.rlipath, conf) wx.Frame.__init__(self, parent=parent, id=id, title=title, **kwargs) self.SetIcon(wx.Icon(os.path.join(globalvar.ICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO)) self.panel = wx.Panel(parent=self, id=wx.ID_ANY) self.confilesBox = StaticBox( parent=self.panel, id=wx.ID_ANY, label=_( "View and modify the " "configuration file '{name}'".format( name=self.confile))) self.textCtrl = TextCtrl(parent=self.panel, id=wx.ID_ANY, style=wx.TE_MULTILINE, size=(-1, 75)) self.textCtrl.Bind(wx.EVT_TEXT, self.OnFileText) f = open(self.pathfile) self.textCtrl.SetValue(''.join(f.readlines())) f.close() # BUTTONS #definition self.btn_close = Button(parent=self, id=wx.ID_EXIT) self.btn_ok = Button(parent=self, id=wx.ID_SAVE) self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose) self.btn_ok.Bind(wx.EVT_BUTTON, self.OnOk) self._layout() self.enc = locale.getdefaultlocale()[1]
def __init__(self, parent, conf, giface=None, id=wx.ID_ANY, title=_("Modify the configuration file"), style=wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER, **kwargs): # VARIABLES self.parent = parent self.rlipath = retRLiPath() self.confile = conf self.pathfile = os.path.join(self.rlipath, conf) wx.Frame.__init__(self, parent=parent, id=id, title=title, **kwargs) self.SetIcon(wx.Icon(os.path.join(globalvar.ICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO)) self.panel = wx.Panel(parent=self, id=wx.ID_ANY) self.confilesBox = wx.StaticBox( parent=self.panel, id=wx.ID_ANY, label=_( "View and modify the " "configuration file '{name}'".format( name=self.confile))) self.textCtrl = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY, style=wx.TE_MULTILINE, size=(-1, 75)) self.textCtrl.Bind(wx.EVT_TEXT, self.OnFileText) f = open(self.pathfile) self.textCtrl.SetValue(''.join(f.readlines())) f.close() # BUTTONS #definition self.btn_close = wx.Button(parent=self, id=wx.ID_EXIT) self.btn_ok = wx.Button(parent=self, id=wx.ID_SAVE) self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose) self.btn_ok.Bind(wx.EVT_BUTTON, self.OnOk) self._layout() self.enc = locale.getdefaultlocale()[1]
def __init__(self, parent, giface=None, id=wx.ID_ANY, title=_("GRASS" " GIS Setup for r.li modules"), style=wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER, **kwargs): # VARIABLES self.parent = parent # self.cmd = "r.li.setup" self.rlipath = retRLiPath() self.listfiles = self.ListFiles() # END VARIABLES # init of frame wx.Frame.__init__(self, parent=parent, id=id, title=title, **kwargs) self.SetIcon( wx.Icon(os.path.join(globalvar.ICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO)) self.panel = wx.Panel(parent=self, id=wx.ID_ANY) # box for select configuration file self.confilesBox = wx.StaticBox( parent=self.panel, id=wx.ID_ANY, label=_('Available sampling area configuration files')) self.listfileBox = wx.ListBox(parent=self.panel, id=wx.ID_ANY, choices=self.listfiles) # BUTTONS #definition self.btn_close = wx.Button(parent=self, id=wx.ID_CLOSE) self.btn_help = wx.Button(parent=self, id=wx.ID_HELP) self.btn_remove = wx.Button(parent=self, id=wx.ID_ANY, label=_("Remove")) self.btn_remove.SetToolTipString(_('Remove a configuration file')) self.btn_new = wx.Button(parent=self, id=wx.ID_ANY, label=_("Create")) self.btn_new.SetToolTipString(_('Create a new configuration file')) self.btn_rename = wx.Button(parent=self, id=wx.ID_ANY, label=_("Rename")) self.btn_rename.SetToolTipString(_('Rename a configuration file')) self.btn_view = wx.Button(parent=self, id=wx.ID_ANY, label=_("View/Edit")) self.btn_view.SetToolTipString(_('View and edit a configuration file')) # set action for button self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose) self.btn_help.Bind(wx.EVT_BUTTON, self.OnHelp) self.btn_remove.Bind(wx.EVT_BUTTON, self.OnRemove) self.btn_new.Bind(wx.EVT_BUTTON, self.OnNew) self.btn_rename.Bind(wx.EVT_BUTTON, self.OnRename) self.btn_view.Bind(wx.EVT_BUTTON, self.OnView) self._layout() # END BUTTONS # SIZE FRAME self.SetMinSize(self.GetBestSize()) # Please check this because without this the size it is not the min self.SetClientSize(self.GetBestSize())
def __init__( self, parent, giface=None, id=wx.ID_ANY, title=_("GRASS" " GIS Setup for r.li modules"), style=wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER, **kwargs): # VARIABLES self.parent = parent # self.cmd = "r.li.setup" self.rlipath = retRLiPath() self.listfiles = self.ListFiles() # END VARIABLES # init of frame wx.Frame.__init__(self, parent=parent, id=id, title=title, **kwargs) self.SetIcon(wx.Icon(os.path.join(globalvar.ICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO)) self.panel = wx.Panel(parent=self, id=wx.ID_ANY) # box for select configuration file self.confilesBox = wx.StaticBox( parent=self.panel, id=wx.ID_ANY, label=_('Available sampling area configuration files')) self.listfileBox = wx.ListBox(parent=self.panel, id=wx.ID_ANY, choices=self.listfiles) # BUTTONS #definition self.btn_close = wx.Button(parent=self, id=wx.ID_CLOSE) self.btn_help = wx.Button(parent=self, id=wx.ID_HELP) self.btn_remove = wx.Button(parent=self, id=wx.ID_ANY, label=_("Remove")) self.btn_remove.SetToolTipString(_('Remove a configuration file')) self.btn_new = wx.Button(parent=self, id=wx.ID_ANY, label=_("Create")) self.btn_new.SetToolTipString(_('Create a new configuration file')) self.btn_rename = wx.Button(parent=self, id=wx.ID_ANY, label=_("Rename")) self.btn_rename.SetToolTipString(_('Rename a configuration file')) self.btn_view = wx.Button(parent=self, id=wx.ID_ANY, label=_("View/Edit")) self.btn_view.SetToolTipString(_('View and edit a configuration file')) # set action for button self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose) self.btn_help.Bind(wx.EVT_BUTTON, self.OnHelp) self.btn_remove.Bind(wx.EVT_BUTTON, self.OnRemove) self.btn_new.Bind(wx.EVT_BUTTON, self.OnNew) self.btn_rename.Bind(wx.EVT_BUTTON, self.OnRename) self.btn_view.Bind(wx.EVT_BUTTON, self.OnView) self._layout() # END BUTTONS # SIZE FRAME self.SetMinSize(self.GetBestSize()) # Please check this because without this the size it is not the min self.SetClientSize(self.GetBestSize())