home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-03-30 | 30.7 KB | 1,073 lines |
- /**
- * Module: inst_sw_single.ycp
- *
- * Authors: Gabriele Strattner <gs@suse.de>
- *
- * Purpose:
- * Called with `single:
- * Provides a list of package sets on the left and the corresponding
- * packages to a selected set on the right.
- * A Table Widget is filled with the packages and the user can select
- * the wanted ones. The selected packages are marked with "X". If needed
- * packages are shown in the list they are marked with an "a".
- * The needed disk space is checked with every user input and is
- * displayed.
- * Called with `pay:
- * Provides one set (pay) on left and all pay packages on right.
- *
- *
- *
- * user_settings read: see module inst_pkg_toinstall
- * lookup( user_settings, "targets" )
- *
- * user_settings write: see module inst_pkg_toinstall/inst_sw_detail
- *
- *
- * $Id: inst_sw_single.ycp,v 1.43 2000/03/08 17:03:26 kkaempf Exp $
- */
-
-
- {
- any ret = nil;
- boolean retval = false;
-
- string actual_set = ""; // actual selected set
- string actual_pac = ""; // actual selected package
- map set_pacs = $[]; // all packages belonging to selected set
- map all_sets = $[]; // all available package sets
-
- integer initial_used = 0; // used disk space at begin of installation in bytes
-
- string descr_all = "zall"; // short description for all packages
- string default_set = "a"; // first package list when entering dialog
- string pay_set = "pay"; // set commercial packages
-
- map set_descr =
- $[
- // We need a short (about 25 characters) description for all following sets
- // ( Linux Base System to List of all Packages ).
- //
- // Linux Base System (You need it!)
- "a": UI(_("Linux Base System")),
- // Programs that don't need X
- "ap": UI(_("Programs without X")),
- // ApplixWare Office
- "aplx": UI(_("ApplixWare Office")),
- // Extreme Linux (Beowulf)
- "beo": UI(_("Extreme Linux (Beowulf)")),
- // Development (C, C++, Lisp, etc.)
- "d": UI(_("Development (C, C++, Lisp)")),
- // Documentation
- "doc": UI(_("Documentation")),
- // Emacs
- "e": UI(_("Emacs")),
- // Emulators
- "emu": UI(_("Emulators")),
- // Games and more
- "fun": UI(_("Games and more")),
- // GNOME - GNU Network Object Model Environment
- "gnm": UI(_("GNOME")),
- // All about graphics
- "gra": UI(_("All about graphics")),
- // Amateur Radio (AX.25, CW, Logs, etc.)
- "ham": UI(_("Amateur Radio (AX.25, CW)")),
- // K Desktop Environment
- "kde": UI(_("K Desktop Environment")),
- // KDE alpha applications
- "kpa": UI(_("KDE alpha applications")),
- // Network-Support (TCP/IP, UUCP, Mail, News)
- "n": UI(_("Network (TCP/IP, UUCP)")),
- // Commercial Software
- "pay": UI(_("Commercial Software")),
- // Security related software
- "sec": UI(_("Security")),
- // Components for a SGML system
- "sgm": UI(_("Components for SGML")),
- // Sound related stuff
- "snd": UI(_("Sound related stuff")),
- // Spell checking utilities and databases
- "spl": UI(_("Dictionaries")),
- // SuSE internal Software
- "suse": UI(_("SuSE internal Software")),
- // Tcl/Tk/TclX, Tcl-Language and Tk-Toolkit for X
- "tcl": UI(_("Tcl/Tk/TclX")),
- // TeX/LaTeX and applications
- "tex": UI(_("TeX/LaTeX and appl.")),
- // Base X Window System - XFree86\tm 3.3
- "x": UI(_("Base X Window System")),
- // 3D stuff for X11 and console
- "x3d": UI(_("3D stuff for X11")),
- // X Applications
- "xap": UI(_("X Applications")),
- // Development under X11
- "xdev": UI(_("Development under X11")),
- //Several X Servers (XFree86\tm 3.3 and other)
- "xsrv": UI(_("X Servers (XFree86[tm]")),
- // XView (OpenLook, Applications)
- "xv": UI(_("XView (OpenLook)")),
- // Window Manager and Desktop
- "xwm": UI(_("Window Manager")),
- //Additional packets for SuSE Linux IMAP Server
- "zima": UI(_("SuSE IMAP Server")),
- // Source packages
- "zq": UI(_("Source packages")),
- // All packages
- "zall": UI(_("List of all Packages"))
- ];
-
- //
- // Get packages belonging to selected "set" and create input for Table Widget
- //
- // map set_pacs:
- // $["aaa_base":["SuSE Linux Basispaket", "X"], "aaa_dir":["SuSE Linux Verzeichnisstruktur", "a"], ...
- // key : value 0 1
- // Create table input, e.g.
- // [ `item( `id("aaa_base"), "X", "aaa_base", "SuSE Linux base package", "45.34 MB" ), ... ]
-
- define CreatePacTable( string set ) ``{
-
- list table_input = [];
- set_pacs = $[];
-
- // Get list of packages belonging to selected set
- if ( set != descr_all )
- {
- set_pacs = PKGINFO( `getHierarchyInformation( set ) );
- }
- else
- {
- set_pacs = PKGINFO( `getPackageList( ) );
- }
-
- table_input = maplist( `key, `value,
- set_pacs,
- ``(`item(`id(key), select(value,1), key, select(value,0), my_size_text(select(value,2)*1024) )) );
-
- return ( table_input );
- };
-
- //
- // Update single lines in table
- //
-
- define UpdateTable( string set ) ``{
- map upd_pacs = $[];
-
- // Get list of packages belonging to selected set with new status information
- if ( set != descr_all )
- {
- upd_pacs = PKGINFO( `getHierarchyInformation( set ) );
- }
- else
- {
- upd_pacs = PKGINFO( `getPackageList( ) );
- }
-
- // map set_pacs:
- // $["aaa_base":["SuSE Linux Basispaket", "X"], "aaa_dir":["SuSE Linux Verz.", "a"], ...
- // key : value 0 1
-
- list old_value = [];
-
- maplist( `key, `value, upd_pacs, ``({
-
- old_value = lookup( set_pacs, key );
-
- if ( select( old_value, 1 ) != select(value, 1) )
- {
- _debug( "Update line: ", old_value );
- UI( `ChangeWidget(`id(`pac_table), `Item( key, 0 ), select(value, 1) ) );
-
- } } ) );
-
- set_pacs = upd_pacs; // save new status info
- };
-
- //
- // Create input for table partition info
- //
-
- define CreatePartTable( list part_info ) ``{
-
- list part_input = [];
-
- foreach( `part, part_info,
- ``{
- string part_name = lookup( part, "name" );
- integer free_space = lookup( part, "free" );
-
- term a = `item(`id(part_name), part_name, UI( `size_text( free_space*1024)) );
-
- part_input = add( part_input, a );
- } );
-
- return( part_input );
- };
-
- //
- // Select a package
- //
-
- define SelectPac( string package ) ``{
- string msg = "";
-
- any r = PKGINFO( `selectInstall( package ));
- _debug( "PKGINFO selectInstall: ", package );
-
- msg = PKGINFO( `getNotifyDesc( package ) );
- if ( msg != "" )
- {
- string nty_title = " " + UI(_("Notify")) + " ";
- term msg_text = `RichText( "<p>" + package + "</p>" + "<p>" + msg + "</p>" );
- UI( `DisplayHelpMsg( nty_title, msg_text, false) );
- }
- };
-
- //
- // Deselect a package
- //
-
- define DeselectPac( string package ) ``{
- string msg = "";
-
- any r = PKGINFO( `deselectInstall( package ));
- _debug( "PKGINFO deselectInstall: ", package );
-
- msg = PKGINFO( `getDelDesc( package ) );
- if ( msg != "" )
- {
- string wrn_title = " " + UI(_("Warning")) + " ";
- term msg_text = `RichText( "<p>" + package + "</p>" + "<p>" + msg + "</p>" );
- UI( `DisplayHelpMsg( wrn_title, msg_text, true) );
- }
- };
-
- //
- // Calculate required disk space
- //
-
- define GetRequSpace( list part_info, boolean initialize ) ``{
-
- integer used = 0;
- foreach( `part, part_info,
- ``{
- used = used + lookup( part, "used" );
- } );
-
- if ( initialize )
- {
- initial_used = used; // store initial value for used space
- return ( UI( `size_text( used*1024 )) );
- }
- else
- {
- return ( UI( `size_text( (used-initial_used)*1024 )) );
- }
- };
-
- //
- // Returns nice size string
- //
- define my_size_text (integer bytes) ``{
-
- if ( bytes == nil )
- return "";
-
- float whole = tofloat (bytes) / 1024.0 / 1024.0;
- string unit = UI(_("MB"));
-
- // nnn.nn 999.99 MB
-
- string size_str = tostring (whole, 2);
- integer num = size(size_str);
- integer anz = 6 - num;
-
- if ( anz <= 0 )
- {
- return ( size_str + " " + unit );
- }
- else if ( anz == 1 )
- {
- return ( " " + size_str + " " + unit );
- }
- else
- {
- return ( " " + size_str + " " + unit );
- }
- };
-
- //
- // Popup displays helptext
- //
-
- UI( ``{
- define DisplayHelpMsg( string headline, term helptext, boolean color ) ``{
-
- if ( color )
- {
- OpenDialog( `opt ( `decorated, `warncolor ),
- `VBox (`Heading( headline ),
- helptext, // e.g. `Richtext()
- `PushButton( `opt(`default), _("OK") )
- )
- );
- }
- else
- {
- OpenDialog(`opt ( `decorated ),
- `VBox (`Heading( headline ),
- helptext, // e.g. `Richtext()
- `PushButton( `opt(`default), _("OK") )
- )
- );
- }
-
- any r = UserInput();
- CloseDialog();
- return (r);
- };
- });
-
- //
- // Get dependencies from pkginfo + display popup OR / XOR dependencies.
- //
- // $["AND": , "OR":[$["name":"example1", "packages":["aaa", "bbb", "ccc"]],
- // $["name":"example2", "packages":["aaa", "abc", "ddd"]]], "XOR":[]]
- //
- // We do not show all OR/XOR Popups in one loop but only the first dependency, because
- // after a new check with getDependencies some dependencies could be resolved.
- //
-
- define CheckDependencies( ) ``{
- repeat {
- map pac_depends = $[];
- list(map) or_depends = [];
-
- pac_depends = PKGINFO(`getDependencies());
- _debug( "Dependencies:", pac_depends );
-
- or_depends = lookup( pac_depends, "OR" );
-
- if ( or_depends != [] )
- {
- map first_dep = select( or_depends, 0 ); // get first dependency
-
- list pac_list = lookup( first_dep, "packages" );
- string pac_name = lookup( first_dep, "name" );
- // _debug( "first package list: ", pac_list );
-
- list or_table = [];
-
- foreach( `pac, pac_list, ``{
- or_table = add( or_table, `item(`id(pac), pac, PKGINFO(`getShortDesc(pac))) );
- }
- );
- // The user have to choose an additional package from a package list
- any ret = UI(`DisplayOrList( _("Additional package required"),
- sformat( UI(_("Package \"%1\" requires an additional package.\nPlease select one from list below.")),
- pac_name ), or_table ) );
-
- if ( ret == nil ) break;
-
- if ( ret != 0 )
- {
- // DisplayOrList returns selected package
- SelectPac( ret );
-
- //any r = PKGINFO( `selectInstall( ret ));
- //_debug( "PKGINFO selectInstall: ", ret );
- }
- else if ( ret == 0 )
- {
- // User decides to cancel that OR dependency
- any r = PKGINFO( `deleteOrDependencies( pac_name, pac_list ) );
- _debug( "PKGINFO deleteOrDependencies: ", pac_name, pac_list );
- }
- }
- } until ( or_depends == [] );
-
- repeat {
-
- map pac_depends = $[];
- list(map) xor_depends = [];
-
- pac_depends = PKGINFO(`getDependencies());
- _debug("Dependencies: ", pac_depends );
-
- xor_depends = lookup( pac_depends, "XOR" );
- _debug( "XOR Dependencies:", xor_depends );
-
- if ( xor_depends != [] )
- {
- map first_dep = $[];
-
- // If actual_pac is in XOR-list display that dependency first
- foreach ( `pac, xor_depends, ``{
- if ( lookup( pac, "name") == actual_pac )
- first_dep = pac;
- } );
- // Dependencies are not direct related to actual_pac
- if ( first_dep == $[] )
- {
- first_dep = select( xor_depends, 0 ); // get first
- }
-
- string pac_name = lookup( first_dep, "name" );
- list pac_list = lookup( first_dep, "packages" );
- _debug( "first package list: ", pac_list );
-
- // This popup is shown if packages cannot installed together
- string msg_str = sformat( UI(_("Package \"%1\" interferes with:\n")), pac_name );
-
- foreach ( `pac, pac_list, ``{
- msg_str = msg_str + sformat("\"%1\"\n", pac );
- } );
- // question to user: install package anyway or not?
- msg_str = msg_str + sformat(UI(_( "Do you want to install package \"%1\"")), pac_name );
-
- // Headline of the popup Package ... interferes with ...
- any ret = UI(`DisplayXorList( _("Package conflict"), msg_str ) );
-
- if ( ret == `yes_install ) // install package anyway and forget dependencies
- {
- foreach( `pac, pac_list, ``{
- any r = PKGINFO( `deleteXorDependencies( pac_name, pac ));
- _debug( "PKGINFO deleteXorDependencies: ", pac_name, pac );
- r = PKGINFO( `deleteXorDependencies( pac, pac_name ));
- _debug( "PKGINFO deleteXorDependencies: ", pac, pac_name );
- } );
-
- if ( pac_name != actual_pac )
- {
- SelectPac( pac_name );
-
- //any r = PKGINFO( `selectInstall( pac_name ));
- //_debug( "PKGINFO selectInstall: ", pac_name );
- }
- }
- else if ( ret == `no_let_it ) // do not install package
- {
- if ( !contains( lookup( pac_depends, "AND" ), pac_name ) )
- {
- // package is NOT automatically selected -> deselect it
- DeselectPac( pac_name );
-
- //any r = PKGINFO( `deselectInstall( pac_name ));
- //_debug( "PKGINFO deselectInstall: ", pac_name );
-
- }
- else
- {
- // package will be selected again - delete it or install it?
- string yesorno = sformat(UI(_("\
- \"%1\" is an automatically selected package,\n\
- that means another package depends on it.\n\
- Shall YaST2 remove it from installation list?\n\
- YES will deselect the package\n\
- NO will install it")), pac_name );
-
- any r = UI( `YesOrNo( yesorno, _("&Yes"), _("&No") ) );
- if ( r == true )
- {
- PKGINFO( `deleteAndDependencies( pac_name ));
- _debug( "PKGINFO deleteAndDependencies: ", pac_name );
-
- DeselectPac( pac_name );
-
- //any r = PKGINFO(`deselectInstall(pac_name));
- //_debug( "PKGINFO deselectInstall: ", pac_name );
-
- }
- else
- {
- foreach( `pac, pac_list, ``{
- any r = PKGINFO( `deleteXorDependencies( pac_name, pac ));
- _debug( "PKGINFO deleteXorDependencies: ", pac_name, pac );
- r = PKGINFO( `deleteXorDependencies( pac, pac_name ));
- _debug( "PKGINFO deleteXorDependencies: ", pac, pac_name );
- } );
- }
- }
- }
- }
- } until ( xor_depends == [] );
- };
-
-
- //
- // Popup displays the OR dependencies
- //
-
- UI( ``{
- define DisplayOrList(string popup_label, string list_label, list table_contents) ``{
- OpenDialog(`opt( `decorated),
- `VBox( `Heading( popup_label ),
- `Label( list_label ),
- `VBox( `Table( `id(`table_or),
- // This is a popup with a list of several packages.
- // The list has 2 colums, the name and the package description.
- // The user should choose a package.
- `header( _("Name"), _("Description") ),
- table_contents ),
- // user cancels dialog und must decide later
- `HBox( `PushButton( `id(`cancel), _("Cancel") ),
- // the user doesnt want a package from list
- `PushButton( `id(`none), _("None") ),
- `PushButton( `id(`ready), `opt(`default), _("OK") )
- )
- )
- )
- );
-
- any r = UserInput();
-
- if ( r == `cancel )
- {
- CloseDialog();
- return nil;
- }
- else if ( r == `ready )
- {
- any ret = QueryWidget( `id(`table_or), `CurrentItem );
- CloseDialog();
- return( ret );
- }
- else if ( r == `none )
- {
- CloseDialog();
- return ( 0 );
- }
- else
- {
- CloseDialog();
- return ( r );
- }
- };
- });
-
- //
- // Popup display XOR dependencies
- //
-
- UI( ``{
- define DisplayXorList(string popup_label, string popup_contents ) ``{
- OpenDialog(`opt(`decorated),
- `VBox( `Heading( popup_label ),
- `VBox( `Label( popup_contents ),
- // This is a popup with message "package1 interferes with package2".
- // The question is: do not install package 1 or install it anyway!
- `HBox( `PushButton( `id(`no_let_it), `opt(`default), _("No installation") ),
- `PushButton( `id(`yes_install), _("Install it anyway") )
- )
- )
- )
- );
- any r = UserInput();
- CloseDialog();
- return (r);
- };
- });
-
- //
- // Initialize PKGINFO server -> all initialisation is done in former modules
- //
-
- //
- // Get info about targets and partitions
- //
-
- map targetMap = lookup( user_settings, "targets", $[] );
-
- if ( lookup(user_settings, "test_mode", false) == true )
- {
- // TEST VALUES !!!
- targetMap = $[
- "/dev/sda":$[
- "bus":"SCSI",
- "name":"1. SCSI, 8.54 GB, /dev/sda, IBM-DNES-309170W",
- "cyl_count":1114,
- "cyl_size":8224768,
- "vendor":"IBM DNES-309170W",
- "partitions":[
- $["fsid":131, // YES: mount
- "mount":"/boot",
- "fstype":"Linux native",
- "nr":1,
- "region":[1, 254],
- "type":`primary],
- $["delete":true, // NO: no mount
- "fsid":130,
- "fstype":"Linux swap",
- "nr":2,
- "region":[255, 299],
- "type":`primary],
- $["create":false, // NO: create false
- "fsid":131,
- "mount":"/var",
- "fstype":"Linux native",
- "nr":3,
- "region":[300, 499],
- "type":`primary],
- $["create":true, // YES: create true + mount
- "fsid":131,
- "mount":"/",
- "nr":4,
- "format":true,
- "region":[500, 844],
- "type":`primary
- ]
- ]
- ],
- "/dev/sdb":$[
- "bus":"SCSI",
- "name":"1. SCSI, 8.54 GB, /dev/sda, IBM-DNES-309170W",
- "cyl_count":11141,
- "cyl_size":8224768,
- "vendor":"IBM DNES-309170-XEW",
- "partitions":[
- $["fsid":131, // NO: nothing
- "fstype":"Linux native",
- "nr":1,
- "region":[1, 254],
- "type":`primary],
- $["create":true, // NO: no mount
- "fsid":130,
- "fstype":"Linux swap",
- "nr":2,
- "region":[255, 299],
- "type":`primary],
- $["delete":true, // NO: delete false
- "fsid":131,
- "mount":"/var",
- "fstype":"Linux native",
- "nr":3,
- "region":[300, 499],
- "type":`primary],
- $[ "delete":false, // YES: delete true
- "fsid":130,
- "mount":"/usr",
- "fstype":"Linux swap", // user-visible string
- "nr":4, // partition number, as seen by linux (!)
- "region": [500,10871], // start end of region in cyl.s
- "use":true, // mark as 'used' in inst_target_partition
- "type":`primary
- ]
- ] ] ];
-
- // End TEST VALUES
- }
-
- // Get information about available partitions
- list partition = get_partition_info( targetMap, true );
-
- _debug( "PartitionInfo: ", partition);
-
- // initialize used space at begin of installation
- GetRequSpace( partition, true );
-
- // initialisation of pkginfo is done by inst_sw_select
-
- //
- // OpenDialog with set "a" for Single or set "pay" for Pay Selection
- //
-
- list set_input = [];
-
- if ( Args(0) == `single )
- {
- actual_set = default_set;
-
- all_sets = PKGINFO(`getHierarchyInformation( ));
- all_sets = add( all_sets, descr_all, [] ); // add "zall"
- foreach( `set, `value, all_sets,
- ``{
- term a = `item(`id(set), set, lookup( set_descr, set ) );
- set_input = add( set_input, a );
- } );
- }
- else
- {
- actual_set = pay_set;
-
- term a = `item(`id(actual_set), actual_set, lookup( set_descr, actual_set ) );
- set_input = add( set_input, a );
-
- }
-
- list(map) partition_info = PKGINFO ( `getDiskSpace ( partition ) );
-
- list part_input = CreatePartTable( partition_info );
-
- string headline = "";
-
- if ( Args(0) == `single )
- {
- // title dialog Software Single Selection
- headline = UI(_("Software Single Selection"));
- }
- else
- {
- // title dialog Commercial Package Selection
- headline = UI(_("Commercial Package Selection"));
- }
-
- UI( `OpenDialog(`opt(`defaultsize),
- `VBox( `ReplacePoint( `id(`image) ,`Image(`suseheader, "SuSE") ),
- `Heading(headline),
- `HBox(
- // headline selection box package sets
- // (the box isn't wide, please keep it short (up to 20 characters)
- `HWeight( 30, `HCenter( `Label( _("Please select a set") ) ) ),
- // headline selection box packages belonging to selected set
- `HWeight( 70, `HCenter( `Label( _("Please select or deselect a package with double click") ) ) )
- ),
- `HBox(
- `HWeight( 30, `VBox(
- `VWeight( 70, `Table( `id(`set_table), `opt(`notify, `immediate, `vshrinkable),
- // The short description of the package set e.g. "dev", "x".
- // Please keep it short, it's a column header ( up to 6 chars )
- `header( _("Set"), _("Description") ),
- set_input ) ),
- `VWeight( 22, `Table( `id(`part_table), `opt(`vshrinkable),
- `header( _("Partition"), _("Free space")),
- part_input ) ),
- `VWeight( 10, `VBox(
- `Left ( `Label(`id(`req_space), sformat(UI(_("Required: %1")),
- GetRequSpace(partition_info, false))
- )
- ),
- `VStretch()
- )
- )
- )
- ),
- `HWeight( 70, `VBox( `Table( `id(`pac_table), `opt(`notify ),
- `header( " ", _("Package"), _("Description"), `Right(_("Size") )),
- CreatePacTable( actual_set ) ),
- `HBox(
- `Left(`HWeight( 10, ( `PushButton(`id(`descr), `opt(`default), _("&Description"))) )),
- `Right(`HWeight( 10, ( `PushButton(`id(`single_help), _("&Help") ) )))
- )
- )
- )
- ),
-
- `HBox( `HWeight( 10, `Left( `PushButton(`id(`cancel), _("&Cancel"))) ),
- `HWeight( 10, `Right(`PushButton(`id(`ok), _("&OK") )) )
- )
- )
- )
- );
-
- SetWizardStage( 3, true );
-
- //
- // save state solver and dependencies in case of `cancel
- //
- retval = PKGINFO( `saveState() );
- _debug( "return saveState: ", retval );
-
- //
- // Check dependencies ( maybe there are some unresolved dependencies )
- //
- if ( PKGINFO( `isSingleSelected() ) )
- {
- CheckDependencies();
- }
-
- if ( Args(1) == `only_check )
- {
- UI( `CloseDialog() );
-
- // Delete saved information in pkginfo
- retval = PKGINFO( `deleteOldState() );
- return `ok;
- }
-
- while (true)
- {
- ret = UI(`UserInput());
-
- if ( ret == `set_table )
- {
- term set_line = `item();
-
- // Get selected set
- actual_set = UI(`QueryWidget(`id(`set_table), `CurrentItem));
-
- list new_input = CreatePacTable( actual_set );
-
- UI( `ChangeWidget(`id(`pac_table), `Items, new_input) );
- }
- else if ( ret == `pac_table )
- {
- // Get information about selected line (package)
- any id = UI( `QueryWidget(`id(`pac_table), `CurrentItem) );
-
- // notify vom TableWidget kommt anscheinend nach Neuaufbau (ChangeWigdet) nochmal
- // QueryWidget liefert dann nil
- if ( id != nil )
- {
- term table_line = UI( `QueryWidget(`id(`pac_table), `Item(id)) );
-
- actual_pac = select( table_line, 2 );
- _debug( "Actual selected package: ", actual_pac );
-
- if ( ( select(table_line, 1) == "X" ) )
- {
- DeselectPac( actual_pac );
-
- //retval = PKGINFO(`deselectInstall( actual_pac ));
- //_debug( "PKGINFO deselectInstall: ", actual_pac );
-
- }
- else if ( ( select(table_line, 1) == "a") )
- {
- any r = UI(`YesOrNo(_("\
- This is an automatically selected package,\n\
- that means another package depends on it.\n\
- Do you really want to deselect it?"), _("&Yes"), _("&No") ) );
- _debug( "YesOrNo ", r );
- if ( r == true )
- {
- PKGINFO( `deleteAndDependencies( actual_pac ));
- _debug( "PKGINFO deleteAndDependencies", actual_pac );
-
- DeselectPac( actual_pac );
-
- //PKGINFO( `deselectInstall( actual_pac ));
- //_debug( "PKGINFO deselectInstall", actual_pac );
-
- }
- }
- else // package is not selected
- {
- SelectPac( actual_pac );
-
- //any r = PKGINFO( `selectInstall( actual_pac ));
- //_debug( "PKGINFO selectInstall", actual_pac );
- }
-
- //
- // Get dependencies from pkginfo + display popup OR / XOR dependencies.
- //
- if ( PKGINFO( `isSingleSelected() ) )
- {
- CheckDependencies();
- }
-
- // Update disk space information
- list(map) partition_info = PKGINFO ( `getDiskSpace ( partition ) );
-
- list new_part_input = CreatePartTable( partition_info );
- UI( `ChangeWidget(`id(`part_table), `Items, new_part_input) );
-
- UI( `ChangeWidget(`id(`req_space), `Value, sformat(UI(_("Required: %1")), GetRequSpace( partition_info, false ))) );
-
- _debug( "RequSpace: ", GetRequSpace( partition_info, false ) );
-
- // Warning message if free space < 0
- string message = "";
- foreach( `par, partition_info,
- ``{
- if ( lookup( par, "free", 0 ) < 0 )
- {
- integer needed = lookup (par, "free") * -1;
- message = message + sformat ( UI(_("Partition \"%1\" needs %2 more disk space.")),
- lookup ( par, "name" ), UI( `size_text(needed*1024) ) ) + "\n";
- }
- } );
-
- if ( size ( message ) > 0 )
- {
- UI(`DisplayMessage(message));
- }
-
- // Update single lines in table widgets ( new status )
- UpdateTable( actual_set );
-
- }
- }
- else if (ret == `single_help)
- {
- term help = `id();
- string help_part = "";
-
- if ( Args(0) == `single )
- {
- // helptext1 for dialog software single selection
- // help1 part 1 of 6
- help_part = UI(_("\
- <p>
- This dialog is devided into two sections: \n
- on the left a list with all available <b>package
- sets</b> and information about disk space, on the
- right a list with <b>every package</b>
- belonging to selected set.
- </p>") );
- // help1 part 2 of 6
- help_part = help_part + UI(_("\
- <p>
- With your basic selection <i>Minimal</i>,<i>Default</i>
- or <i>Almost everything</i> and your choice from
- categories <i>Multimedia</i>, <i>Games</i> and so on, a number
- of packages is preselected.
- Now you have the possibility to make your
- own decision about installing a certain
- package or not.
- YaST2 will show you the totally <b>required space</b>
- for all selected packages and
- <b>free</b> space on every partitions with
- every change.
- </p>") );
- // help1 part 3 of 6
- help_part = help_part + UI(_("\
- <p>
- How to do:
- </p>
- <p>
- <tt>1.</tt> Select a package set in list on
- left and YaST2 will show the corresponding
- packages with status information:
- </p>
- <p>
- <b>X</b> : package is selected for installation
- </p>
- <p>
- <b>_</b> : package is not selected
- </p>
- <p>
- <b>a</b> : YaST2 has automatically selected this
- package because another selected package
- depends on it
- </p>" ) );
- // help1 part 4 of 6
- help_part = help_part + UI(_("\
- <p>
- <tt>2.</tt> To select an additional package for
- installation double click on corresponding line in package
- list. You can also remove a selected package from
- installation list.
- YaST2 will always check the dependencies, that means
- all needed packages will automatically marked with
- an <b>a</b> and all unneeded will be deselected.
- </p>" ) );
- // help1 part 5 of 6
- help_part = help_part + UI(_("\
- <p>
- <tt>3.</tt> For some packages you need at least one of
- several other packages. In that case you can choose
- from a list in popup <em>Additional package required</em>.
- Please note: The package shown in popup is possibly
- not the selected one, but an automatically needed one.\n
- Other packages cannot be installed together. They
- are shown in <em>Package conflict</em> popup and you
- can decide whether to install the package or not.
- </p>" ));
- // help1 part 6 of 6
- help_part = help_part + UI(_("<p>
- For getting a detailed description for each package
- press button <b>Description</b>.
- With button <b>Cancel</b> you will return to
- <b>Detailed Software Selection</b> without saving
- any of your choices, <b>OK</b> will save your selection.
- </p>
- <br>" ));
-
- help = `RichText( help_part );
- // title for popup with helptext
- string help_title = " " + UI(_("Help Software Single Selection")) + " ";
-
- UI( `DisplayHelpMsg( help_title, help, false ) );
- }
- else
- {
- // helptext2 for dialog pay selection
- // help2 part 1 of 2
- help_part = help_part + UI(_("<p>
- Here you can choose which commercial packages should
- be installed.
- </p>
- <p>
- Beware. Not all packages are full-featured versions, some require a
- registration, some are time-limited.
- </p>
- <p>
- You can select an package by clicking on corresponding line or
- deselect a marked one.
- </p>
- <p> The packages are shown with status information:
- </p>
- <p>
- <b>X</b> : package is selected for installation
- </p>
- <p>
- <b>_</b> : package is not selected
- </p>
- <p>
- <b>a</b> : YaST2 has automatically selected this
- package because another selected package
- depends on it
- </p>" ) );
- // help2 part 2 of 2
- help_part = help_part + UI(_("\
- <p>
- For getting a detailed description for each package
- press Button <b>Description</b>.
- With button <b>Cancel</b> you will return to
- <b>Detailed Software Selection</b> without saving
- any of your choices, <b>OK</b> will save your selection.
- </p>
- <br>") );
- help = `RichText( help_part );
- // title for popup with help text
- string help_title = " " + UI(_("Help Commercial Package Selection")) + " ";
- UI( `DisplayHelpMsg( help_title, help, false ) );
-
- }
-
- }
- else if (ret == `descr )
- {
- any sel_pac = UI(`QueryWidget(`id(`pac_table), `CurrentItem));
-
- if (sel_pac != nil)
- {
- term long_desc = `RichText( sformat( "<p> %1 </p>",
- PKGINFO(`getLongDesc( sel_pac )) ) );
- UI( `DisplayHelpMsg( sformat( " %1 ", sel_pac ), long_desc, false ) );
- }
- }
- else if (ret == `cancel)
- {
- // Restore old selection and former dependencies
- retval = PKGINFO( `restoreState() );
- _debug( "Return restoreState:", retval );
-
- break;
- }
- else if ( ret == `ok )
- {
- // Add selected packages to user_settings -> inst_sw_detail
- _debug( "Return inst_sw_single: ", ret );
- // Check again dependencies
- if ( PKGINFO( `isSingleSelected() ) )
- {
- CheckDependencies();
- }
- break;
- }
-
- }
-
- UI( `CloseDialog() );
-
- // Delete saved information in pkginfo
- retval = PKGINFO( `deleteOldState() );
-
- return ret;
-
- }
-
-
-