Author: dfiser Date: Wed Oct 10 18:59:00 2007 New Revision: 41350 URL: http://svn.opensuse.org/viewcvs/yast?rev=41350&view=rev Log: - Modified skeleton to do not use global variables of modules directly. - Added python module into skeleton and fixed perl module there. Added: trunk/devtools/devtools/skeletons/config/src/XXPkgXX3.py Modified: trunk/devtools/devtools/skeletons/config/src/Makefile.am trunk/devtools/devtools/skeletons/config/src/XXPkgXX.ycp trunk/devtools/devtools/skeletons/config/src/XXPkgXX2.pm (contents, props changed) trunk/devtools/devtools/skeletons/config/src/XXpkgXX_auto.ycp trunk/devtools/devtools/skeletons/config/src/XXpkgXX_proposal.ycp trunk/devtools/devtools/skeletons/config/src/complex.ycp Modified: trunk/devtools/devtools/skeletons/config/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/devtools/devtools/skeletons/config/src/Makefile.am?rev=41350&r1=41349&r2=41350&view=diff ============================================================================== --- trunk/devtools/devtools/skeletons/config/src/Makefile.am (original) +++ trunk/devtools/devtools/skeletons/config/src/Makefile.am Wed Oct 10 18:59:00 2007 @@ -18,7 +18,8 @@ module_DATA = \ XXPkgXX.ycp \ - XXPkgXX2.pm + XXPkgXX2.pm \ + XXPkgXX3.py # create a symlink for local build, #145327 XXpkgXX: Modified: trunk/devtools/devtools/skeletons/config/src/XXPkgXX.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/devtools/devtools/skeletons/config/src/XXPkgXX.ycp?rev=41350&r1=41349&r2=41350&view=diff ============================================================================== --- trunk/devtools/devtools/skeletons/config/src/XXPkgXX.ycp (original) +++ trunk/devtools/devtools/skeletons/config/src/XXPkgXX.ycp Wed Oct 10 18:59:00 2007 @@ -48,23 +48,23 @@ /** * Data was modified? */ -global boolean modified = false; +boolean modified = false; /** */ -global boolean proposal_valid = false; +boolean proposal_valid = false; /** * Write only, used during autoinstallation. * Don't run services and SuSEconfig, it's all done at one place. */ -global boolean write_only = false; +boolean write_only = false; /** * Abort function * return boolean return true if abort */ -global boolean() AbortFunction = Modified; +boolean() AbortFunction = Modified; /** * Abort function @@ -90,10 +90,38 @@ /** * Mark as modified, for Autoyast. */ -global void SetModified() { - modified = true; +global void SetModified(boolean value) { + modified = true; + } + +global boolean ProposalValid() { + return proposal_valid; +} + +global void SetProposalValid(boolean value) { + proposal_valid = value; +} + +/** + * @return true if module is marked as "write only" (don't start services etc...) + */ +global boolean WriteOnly() { + return write_only; } +/** + * Set write_only flag (for autoinstalation). + */ +global void SetWriteOnly(boolean value) { + write_only = value; +} + + +global void SetAbortFunction(boolean() function) { + AbortFunction = function; +} + + // Settings: Define all variables needed for configuration of XXpkgXX // TODO FIXME: Define all the variables necessary to hold // TODO FIXME: the configuration here (with the appropriate Modified: trunk/devtools/devtools/skeletons/config/src/XXPkgXX2.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/devtools/devtools/skeletons/config/src/XXPkgXX2.pm?rev=41350&r1=41349&r2=41350&view=diff ============================================================================== Binary files - no diff available. Added: trunk/devtools/devtools/skeletons/config/src/XXPkgXX3.py URL: http://svn.opensuse.org/viewcvs/yast/trunk/devtools/devtools/skeletons/config/src/XXPkgXX3.py?rev=41350&view=auto ============================================================================== --- trunk/devtools/devtools/skeletons/config/src/XXPkgXX3.py (added) +++ trunk/devtools/devtools/skeletons/config/src/XXPkgXX3.py Wed Oct 10 18:59:00 2007 @@ -0,0 +1,301 @@ +#!/usr/bin/env python + +# ------------------------------------------------------------------------------ +# Copyright (c) 2006 Novell, Inc. All Rights Reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, you may find +# current contact information at www.novell.com. +# ------------------------------------------------------------------------------ + +# File: modules/XXPkgXX3.py +# Package: Configuration of XXpkgXX +# Summary: XXPkgXX settings, input and output functions +# Authors: XXmaintainerXX <XXemailXX> +# +# $Id: XXPkgXX3.py 27914 2006-02-13 14:32:08Z locilka $ +# +# Representation of the configuration of XXpkgXX. +# Input and output routines. + + +from time import sleep +from YCPDeclarations import YCPDeclare +import ycp +from ycp import Term, Symbol, Path +from ycp import y2internal, y2security, y2error, y2warning, y2milestone, y2debug + +## + # Set textdomain + # +import gettext +gettext.install("XXpkgXX") + +ycp.import_module("Progress") +ycp.import_module("Report") +ycp.import_module("Summary") +ycp.import_module("Message") + +## + # Data was modified? + # +modified = False + +## + # +proposal_valid = False + +## + # Write only, used during autoinstallation. + # Don't run services and SuSEconfig, it's all done at one place. + # +write_only = False + +## + # Data was modified? + # @return true if modified + # +@YCPDeclare("boolean") +def Modified(): + global modified + y2debug ("modified=%d" % (modified)); + return modified + +## + # Mark as modified, for Autoyast. + # +@YCPDeclare("void", "boolean") +def SetModified(value): + global modified + modified = value + +@YCPDeclare("boolean") +def ProposalValid(): + global proposal_valid + return proposal_valid + +@YCPDeclare("void", "boolean") +def SetProposalValid(value): + global proposal_valid + proposal_valid = value + +@YCPDeclare("boolean") +def WriteOnly(): + global write_only + return write_only + +@YCPDeclare("void", "boolean") +def SetWriteOnly(value): + global write_only + write_only = value + + +# Settings: Define all variables needed for configuration of XXpkgXX +# TODO FIXME: Define all the variables necessary to hold +# TODO FIXME: the configuration here (with the appropriate +# TODO FIXME: description) +# TODO FIXME: For example: +# ## +# # List of the configured cards. +# # +# cards = [] +# +# ## +# # Some additional parameter needed for the configuration. +# # +# additional_parameter = 1 + +## + # Read all XXpkgXX settings + # @return true on success + # +@YCPDeclare("boolean") +def Read(): + global modified + + # XXPkgXX read dialog caption + caption = _("Initializing XXpkgXX Configuration") + + # TODO FIXME Set the right number of stages + steps = 4 + + sl = 0.5 + sleep(sl) + + # TODO FIXME Names of real stages + # We do not set help text here, because it was set outside + ycp.Progress.New(caption, " ", steps, [ + # Progress stage 1/3 + _("Read the database"), + # Progress stage 2/3 + _("Read the previous settings"), + # Progress stage 3/3 + _("Detect the devices") + ], [ + # Progress step 1/3 + _("Reading the database..."), + # Progress step 2/3 + _("Reading the previous settings..."), + # Progress step 3/3 + _("Detecting the devices..."), + # Progress finished + _("Finished") + ], + "" + ) + + # read database + ycp.Progress.NextStage(); + # Error message + if False: + ycp.Report.Error(_("Cannot read the database1.")) + sleep(sl) + + # read another database + ycp.Progress.NextStep() + # Error message + if False: + ycp.Report.Error(_("Cannot read the database2.")) + sleep(sl) + + # read current settings + ycp.Progress.NextStage() + # Error message + if False: + ycp.Report.Error(ycp.Message.CannotReadCurrentSettings()) + sleep(sl) + + # detect devices + ycp.Progress.NextStage() + # Error message + if False: + ycp.Report.Warning(_("Cannot detect devices.")) + sleep(sl) + + # Progress finished + ycp.Progress.NextStage() + sleep(sl) + + modified = False + + return True + +## + # Write all XXpkgXX settings + # @return true on success + # +@YCPDeclare("boolean") +def Write(): + # XXPkgXX read dialog caption + caption = _("Saving XXpkgXX Configuration") + + # TODO FIXME And set the right number of stages + steps = 2 + + sl = 0.5 + sleep(sl) + + # TODO FIXME Names of real stages + # We do not set help text here, because it was set outside + ycp.Progress.New(caption, " ", steps, [ + # Progress stage 1/2 + _("Write the settings"), + # Progress stage 2/2 + _("Run SuSEconfig") + ], [ + # Progress step 1/2 + _("Writing the settings..."), + # Progress step 2/2 + _("Running SuSEconfig..."), + # Progress finished + _("Finished") + ], + "" + ) + + # write settings + ycp.Progress.NextStage() + # Error message + if False: + ycp.Report.Error (_("Cannot write settings.")) + sleep(sl) + + # run SuSEconfig + ycp.Progress.NextStage() + # Error message + if False: + ycp.Report.Error(ycp.Message.SuSEConfigFailed()) + sleep(sl) + + # Progress finished + ycp.Progress.NextStage() + sleep(sl) + + return True + +## + # Get all XXpkgXX settings from the first parameter + # (For use by autoinstallation.) + # @param settings The YCP structure to be imported. + # @return boolean True on success + # +@YCPDeclare("boolean", "map") +def Import(map_settings): + # TODO FIXME: your code here (fill the above mentioned variables)... + return True + +## + # Dump the XXpkgXX settings to a single map + # (For use by autoinstallation.) + # @return map Dumped settings (later acceptable by Import ()) + # +@YCPDeclare("map") +def Export(): + # TODO FIXME: your code here (return the above mentioned variables)... + return {} + +## + # Create a textual summary and a list of unconfigured cards + # @return summary of the current configuration + # +@YCPDeclare("list") +def Summary(): + # TODO FIXME: your code here... + # Configuration summary text for autoyast + return [ _("Configuration summary ...") ] + +## + # Create an overview table with all configured cards + # @return table items + # +@YCPDeclare("list") +def Overview(): + # TODO FIXME: your code here... + return [] + +## + # Return packages needed to be installed and removed during + # Autoinstallation to insure module has all needed software + # installed. + # @return map with 2 lists. + # +@YCPDeclare("map") +def AutoPackages(): + # TODO FIXME: your code here... + return { + "install" : [], + "remove" : [] + } + +# EOF Modified: trunk/devtools/devtools/skeletons/config/src/XXpkgXX_auto.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/devtools/devtools/skeletons/config/src/XXpkgXX_auto.ycp?rev=41350&r1=41349&r2=41350&view=diff ============================================================================== --- trunk/devtools/devtools/skeletons/config/src/XXpkgXX_auto.ycp (original) +++ trunk/devtools/devtools/skeletons/config/src/XXpkgXX_auto.ycp Wed Oct 10 18:59:00 2007 @@ -98,7 +98,7 @@ else if (func == "Write") { import "Progress"; boolean progress_orig = Progress::set (false); - XXPkgXX::write_only = true; + XXPkgXX::SetWriteOnly (true); ret = XXPkgXX::Write(); Progress::set (progress_orig); } @@ -114,7 +114,7 @@ * return boolean */ else if (func == "SetModified") { - XXPkgXX::SetModified (); + XXPkgXX::SetModified (true); ret = true; } Modified: trunk/devtools/devtools/skeletons/config/src/XXpkgXX_proposal.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/devtools/devtools/skeletons/config/src/XXpkgXX_proposal.ycp?rev=41350&r1=41349&r2=41350&view=diff ============================================================================== --- trunk/devtools/devtools/skeletons/config/src/XXpkgXX_proposal.ycp (original) +++ trunk/devtools/devtools/skeletons/config/src/XXpkgXX_proposal.ycp Wed Oct 10 18:59:00 2007 @@ -52,8 +52,8 @@ symbol warning_level = nil; boolean force_reset = param["force_reset"]:false; - if(force_reset || !XXPkgXX::proposal_valid) { - XXPkgXX::proposal_valid = true; + if(force_reset || !XXPkgXX::ProposalValid()) { + XXPkgXX::SetProposalValid (true); boolean progress_orig = Progress::set (false); XXPkgXX::Read(); Progress::set (progress_orig); Modified: trunk/devtools/devtools/skeletons/config/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/devtools/devtools/skeletons/config/src/complex.ycp?rev=41350&r1=41349&r2=41350&view=diff ============================================================================== --- trunk/devtools/devtools/skeletons/config/src/complex.ycp (original) +++ trunk/devtools/devtools/skeletons/config/src/complex.ycp Wed Oct 10 18:59:00 2007 @@ -63,7 +63,7 @@ */ symbol ReadDialog() { Wizard::RestoreHelp(HELPS["read"]:""); - // XXPkgXX::AbortFunction = PollAbort; + // XXPkgXX::SetAbortFunction(PollAbort); if (!Confirm::MustBeRoot()) return `abort; boolean ret = XXPkgXX::Read(); return ret ? `next : `abort; @@ -75,7 +75,7 @@ */ symbol WriteDialog() { Wizard::RestoreHelp(HELPS["write"]:""); - // XXPkgXX::AbortFunction = PollAbort; + // XXPkgXX::SetAbortFunction(PollAbort); boolean ret = XXPkgXX::Write(); return ret ? `next : `abort; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org