Mailinglist Archive: yast-commit (553 mails)

< Previous Next >
[yast-commit] r60172 - in /trunk/printer: configure.in.in src/Printer.ycp src/basicadd.ycp src/helps.ycp src/wizards.ycp tools/Makefile.am yast2-printer.spec.in
  • From: jsmeix@xxxxxxxxxxxxxxxx
  • Date: Tue, 22 Dec 2009 13:06:30 -0000
  • Message-id: <E1NN4Ra-0003kw-6h@xxxxxxxxxxxxxxxx>
Author: jsmeix
Date: Tue Dec 22 14:06:29 2009
New Revision: 60172

URL: http://svn.opensuse.org/viewcvs/yast?rev=60172&view=rev
Log:

The new function RunHpsetup() together with
the test tool basicadd_displaytest.c implements
to launch HPLIP's printer setup tool 'hp-setup' from
the BasicAdd dialog which provides much better support
for HP network printers and HP all-in-one devices.


Modified:
trunk/printer/configure.in.in
trunk/printer/src/Printer.ycp
trunk/printer/src/basicadd.ycp
trunk/printer/src/helps.ycp
trunk/printer/src/wizards.ycp
trunk/printer/tools/Makefile.am
trunk/printer/yast2-printer.spec.in

Modified: trunk/printer/configure.in.in
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/printer/configure.in.in?rev=60172&r1=60171&r2=60172&view=diff
==============================================================================
--- trunk/printer/configure.in.in (original)
+++ trunk/printer/configure.in.in Tue Dec 22 14:06:29 2009
@@ -4,6 +4,13 @@
@YAST2-INIT-COMMON@
@YAST2-INIT-YCP@

+# tools/basicadd_displaytest needs /usr/include/X11/Xlib.h and
/usr/lib/libX11.so -> xorg-x11-libX11-devel RPM
+yast_found_libX11=no
+AC_CHECK_HEADER(X11/Xlib.h,[yast_found_libX11=yes])
+if [[ "$yast_found_libX11" = "no" ]]
+then AC_MSG_ERROR(Header file X11/Xlib.h missing. Usually the
xorg-x11-libX11-devel RPM is missing.)
+fi
+
## some common checks
@YAST2-CHECKS-COMMON@
@YAST2-CHECKS-YCP@

Modified: trunk/printer/src/Printer.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=60172&r1=60171&r2=60172&view=diff
==============================================================================
--- trunk/printer/src/Printer.ycp (original)
+++ trunk/printer/src/Printer.ycp Tue Dec 22 14:06:29 2009
@@ -2173,6 +2173,83 @@
}

/**
+ * Run hp-setup:
+ * @return false if hp-setup cannot be run and return true in any other case
+ * because there is no usable exit code of hp-setup (always zero even in case
of error).
+ */
+global boolean RunHpsetup()
+{ // First of all the multi-line strings because such strings cannot be
indented:
+ string basicadd_displaytest_failed_message =
+ // Message of a Popup::Error when hp-setup should be run.
+ // Do not change or translate "hp-setup", it is a program name.
+ // Do not change or translate "DISPLAY", it is an environment variable name.
+_("Cannot run hp-setup because no graphical display can be opened.
+This happens in particular when YaST runs in text-only mode,
+or when the user who runs YaST has no DISPLAY environment variable set,
+or when the YaST process is not allowed to access the graphical display.
+In this case you should run hp-setup manually directly as user 'root'.
+");
+ string hpsetup_not_executable_message =
+ // Message of a Popup::Error when hp-setup should be run.
+ // Do not change or translate "hp-setup", it is a program name:
+_("Cannot run hp-setup because
+/usr/bin/hp-setup is not executable
+or does not exist.
+");
+ string hpsetup_busy_message =
+ // Body of a Popup::ShowFeedback.
+ // Do not change or translate "hp-setup", it is a program name:
+_("Launched hp-setup.
+You must finish hp-setup before you can proceed with the printer configuration.
+");
+ if( ! Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir +
"basicadd_displaytest" ) )
+ { // In particular when YaST runs in text-only mode, hp-setup must not be
launched
+ // because it would run without any contact to the user "in the background"
+ // while in the foreground YaST waits for hp-setup to be finished
+ // which is imposible for the user so that the result is a deadlock.
+ // All the user could do is to kill the hp-setup process.
+ // It does not matter if basicadd_displaytest fails orderly because
XOpenDisplay fails
+ // or if it crashes because of missing libX11.so on a minimal installation
without X
+ // because any non-zero exit code indicates that no graphical window can
be opened.
+ y2milestone( "RunHpsetup failed: %1basicadd_displaytest failed.",
Printerlib::yast_bin_dir );
+ Popup::Error( basicadd_displaytest_failed_message );
+ return false;
+ }
+ if( ! Printerlib::TestAndInstallPackage( "hplip", "installed" ) )
+ { y2milestone( "RunHpsetup failed: hplip not installed." );
+ // Only a notification but no installation of HPLIP here.
+ // Installing the package hplip can pull in tons of required packages
+ // because the hplip package does not only provide the 'hp' backend but is
a
+ // full featured multifunction solution with GUI for HP printers and
all-in-one devices.
+ // HPLIP supports printing, scanning, faxing, photo card access, and
device management.
+ // Additionally installing hplip can become very complicated (see
driveradd.ycp).
+ // Therefore the RunHpsetup function is not bloated with installing HPLIP.
+ { Popup::Error( // Popup:::Error when the user had selected to run hp-setup
+ // from the BasicAdd dialog but the RPM package hplip is
not installed:
+ // Do not change or translate "hp-setup", it is a program
name.
+ // Do not change or translate "hplip", it is a package
name.
+ // Translate 'Add Driver' the same as the PushButton name
to go to the "Add Driver" dialog:
+ _("To run hp-setup, the RPM package hplip must be
installed.\nUse 'Add Driver' to install it.")
+ );
+ }
+ return false;
+ }
+ if( ! Printerlib::ExecuteBashCommand( "test -x /usr/bin/hp-setup" ) )
+ { y2milestone( "RunHpsetup failed: /usr/bin/hp-setup not executable or does
not exist." );
+ Popup::Error( hpsetup_not_executable_message );
+ return false;
+ }
+ Popup::ShowFeedback( // No title for a simple busy message:
+ "",
+ // Busy message:
+ hpsetup_busy_message
+ );
+ Printerlib::ExecuteBashCommand( "/usr/bin/hp-setup" );
+ Popup::ClearFeedback();
+ return true;
+}
+
+/**
* Get all printer settings from the first parameter
* (For use by autoinstallation.)
* @param settings The YCP structure to be imported.

Modified: trunk/printer/src/basicadd.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/basicadd.ycp?rev=60172&r1=60171&r2=60172&view=diff
==============================================================================
--- trunk/printer/src/basicadd.ycp (original)
+++ trunk/printer/src/basicadd.ycp Tue Dec 22 14:06:29 2009
@@ -203,13 +203,35 @@
),
`VStretch(),
`Left
- ( `ReplacePoint
- ( `id(`queue_name_input_replace_point),
- `InputField
- ( `id(`queue_name_input),
- // Header of a TextEntry to enter the queue name:
- _("Set &Name"),
- queue_name_proposal
+ ( `HBox
+ ( `ReplacePoint
+ ( `id(`queue_name_input_replace_point),
+ `InputField
+ ( `id(`queue_name_input),
+ // Avoid that it becomes squeezed to only a few
characters in text mode:
+ `opt(`hstretch),
+ // Header of a TextEntry to enter the queue name:
+ _("Set &Name"),
+ queue_name_proposal
+ )
+ ),
+ `HStretch(),
+ `VBox
+ ( `Right
+ ( `Label
+ ( // Label text to run HPLIP's printer setup tool
'hp-setup'
+ // to set up HP printers which runs only in
English language:
+ _("Alternative setup for HP printers (English
only):")
+ )
+ ),
+ `Right
+ ( `PushButton
+ ( `id(`run_hpsetup),
+ // Label of a PushButton to run HPLIP's printer
setup tool 'hp-setup'.
+ // Do not change or translate "hp-setup", it is
a program name:
+ _("Run &hp-setup")
+ )
+ )
)
)
)
@@ -243,11 +265,11 @@
UI::ChangeWidget( `connection_selection, `CurrentItem,
`id(Printer::selected_connections_index) );
}
UI::FakeUserInput( `connection_selection );
- any ret = nil;
+ any user_input = nil;
while(true)
- { ret = UI::UserInput();
- if( ret == `abort || ret == `cancel || ret == `back ) break;
- if( ret == `next )
+ { user_input = UI::UserInput();
+ if( `abort == user_input || `cancel == user_input || `back == user_input )
break;
+ if( `next == user_input )
{ if( Printer::selected_connections_index < 0
&& Printer::selected_ppds_index < 0
)
@@ -341,15 +363,15 @@
// Exit this dialog in any case:
break;
}
- if( ret == `connection_wizard )
+ if( `connection_wizard == user_input )
{ // Exit this dialog and go to the ConnectionWizardDialog via the
sequencer in wizards.ycp:
break;
}
- if( ret == `add_driver )
+ if( `add_driver == user_input )
{ // Exit this dialog and go to the AddDriverDialog via the sequencer in
wizards.ycp:
break;
}
- if( ret == `more_connections )
+ if( `more_connections == user_input )
{ UI::ReplaceWidget( `id(`connection_selection_replace_point),
`Table( `id(`connection_selection),
// By default there is no UserInput()
@@ -385,7 +407,7 @@
UI::FakeUserInput( `connection_selection );
continue;
}
- if( ret == `connection_selection )
+ if( `connection_selection == user_input )
{ integer selected_connection_index = (integer)UI::QueryWidget(
`id(`connection_selection), `CurrentItem );
if( nil == selected_connection_index )
{ Popup::AnyMessage( // Header of a Popup::AnyMessage when no connection
was selected:
@@ -444,6 +466,8 @@
UI::ReplaceWidget( `id(`queue_name_input_replace_point),
`InputField
( `id(`queue_name_input),
+ // Avoid that it becomes squeezed to only a few
characters in text mode:
+ `opt(`hstretch),
// Header of a TextEntry to enter the queue name:
_("Set &Name"),
queue_name_proposal
@@ -451,7 +475,7 @@
);
continue;
}
- if( ret == `driver_selection )
+ if( `driver_selection == user_input )
{ integer selected_ppd_index = (integer)UI::QueryWidget(
`id(`driver_selection), `CurrentItem );
if( nil == selected_ppd_index )
{ Popup::AnyMessage( // Header of a Popup::AnyMessage when no driver was
selected:
@@ -467,7 +491,7 @@
}
continue;
}
- if( ret == `apply_driver_filter )
+ if( `apply_driver_filter == user_input )
{ driver_filter_input_text = (string)UI::QueryWidget(
`id(`driver_filter_input), `Value );
y2milestone( "Drivers for '%1'", driver_filter_input_text );
driver_filter_string = Printer::DeriveDriverFilterString(
driver_filter_input_text );
@@ -495,7 +519,7 @@
);
continue;
}
- if( ret == `more_drivers )
+ if( `more_drivers == user_input )
{ if( non_matching_fallback_driver_filter_string != driver_filter_string )
{ driver_filter_string = "";
}
@@ -619,11 +643,31 @@
);
continue;
}
- y2milestone( "Ignoring unexpected returncode in BasicAddDialog: %1", ret );
+ if( `run_hpsetup == user_input )
+ { // Run hp-setup and wait until it is finished, then go back directly to
the Overview dialog.
+ // Printer::RunHpsetup() returns false only if hp-setup cannot be run.
+ // It returns true in any other case because there is no usable exit
code of hp-setup
+ // (always zero even in case of error).
+ // The hp-setup exit code does not matter because the printer
autodetection in the Overview dialog
+ // will show an appropriate result (e.g. no new print queue if hp-setup
failed):
+ if( ! Printer::RunHpsetup() )
+ { Popup::Error( // Message of a Popup::Error.
+ // Only a simple message because before the RunHpsetup
function was called
+ // and this function would have shown more specific
messages.
+ // Do not change or translate "hp-setup", it is a
program name:
+ _("Failed to run hp-setup.")
+ );
+ continue;
+ }
+ // Exit this dialog and run go back to the Overview dialog via the
sequencer in wizards.ycp
+ // to show the new printer autodetection results:
+ break;
+ }
+ y2milestone( "Ignoring unexpected returncode in BasicAddDialog: %1",
user_input );
continue;
}
y2milestone( "leaving BasicAddDialog" );
- return ret;
+ return user_input;
}

/* EOF */

Modified: trunk/printer/src/helps.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/helps.ycp?rev=60172&r1=60171&r2=60172&view=diff
==============================================================================
--- trunk/printer/src/helps.ycp (original)
+++ trunk/printer/src/helps.ycp Tue Dec 22 14:06:29 2009
@@ -451,26 +451,26 @@
Input fields which require percent-encoded input
are denoted by a '[percent-encoded]' hint.<br>
Listing of characters and their percent encoding:<br>
-space ' ' -&gt; %20<br>
-exclamation mark ! -&gt; %21<br>
-number sign # -&gt; %23<br>
-Dollar sign $ -&gt; %24<br>
-percentage % -&gt; %25<br>
-ampersand &amp; -&gt; %26<br>
-apostrophe / single quotation mark ' -&gt; %27<br>
-left parenthesis ( -&gt; %28<br>
-right parenthesis ) -&gt; %29<br>
-asterisk * -&gt; %2A<br>
-plus sign + -&gt; %2B<br>
-comma , -&gt; %2C<br>
-slash / -&gt; %2F<br>
-colon : -&gt; %3A<br>
-semicolon ; -&gt; %3B<br>
-equals sign = -&gt; %3D<br>
-question mark ? -&gt; %3F<br>
-at sign @ -&gt; %40<br>
-left bracket [ -&gt; %5B<br>
-right bracket ] -&gt; %5D<br>
+space ' ' is percent encoded as %20<br>
+exclamation mark ! is percent encoded as %21<br>
+number sign # is percent encoded as %23<br>
+Dollar sign $ is percent encoded as %24<br>
+percentage % is percent encoded as %25<br>
+ampersand &amp; is percent encoded as %26<br>
+apostrophe / single quotation mark ' is percent encoded as %27<br>
+left parenthesis ( is percent encoded as %28<br>
+right parenthesis ) is percent encoded as %29<br>
+asterisk * is percent encoded as %2A<br>
+plus sign + is percent encoded as %2B<br>
+comma , is percent encoded as %2C<br>
+slash / is percent encoded as %2F<br>
+colon : is percent encoded as %3A<br>
+semicolon ; is percent encoded as %3B<br>
+equals sign = is percent encoded as %3D<br>
+question mark ? is percent encoded as %3F<br>
+at sign @ is percent encoded as %40<br>
+left bracket [ is percent encoded as %5B<br>
+right bracket ] is percent encoded as %5D<br>
For details see 'Uniform Resource Identifier (URI): Generic Syntax' at<br>
http://tools.ietf.org/html/rfc3986<br>
</p>") +
@@ -481,7 +481,7 @@
are autodetected and the appropriate device URI is autogenerated.
For example:<br>
parallel:/dev/lp0<br>
-usb://ACME/FunPrinter<br>
+usb://ACME/Fun%20Printer?serial=A1B2C3<br>
hp:/usb/HP_LaserJet?serial=1234<br>
Usually only the autogenerated device URIs work.
When the device is not autodetected, there is usually no communication

Modified: trunk/printer/src/wizards.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/wizards.ycp?rev=60172&r1=60171&r2=60172&view=diff
==============================================================================
--- trunk/printer/src/wizards.ycp (original)
+++ trunk/printer/src/wizards.ycp Tue Dec 22 14:06:29 2009
@@ -79,7 +79,8 @@
`back : "overview",
`next : "overview",
`connection_wizard : "add_connection_wizard",
- `add_driver : "add_driver_add"
+ `add_driver : "add_driver_add",
+ `run_hpsetup : "overview"
],
"add_connection_wizard" : $[ `abort : `abort,
`back : "add",

Modified: trunk/printer/tools/Makefile.am
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/Makefile.am?rev=60172&r1=60171&r2=60172&view=diff
==============================================================================
--- trunk/printer/tools/Makefile.am (original)
+++ trunk/printer/tools/Makefile.am Tue Dec 22 14:06:29 2009
@@ -15,3 +15,8 @@
test_remote_socket

EXTRA_DIST = $(ybin_SCRIPTS)
+
+ybin_PROGRAMS = basicadd_displaytest
+basicadd_displaytest_SOURCES = basicadd_displaytest.c
+basicadd_displaytest_LDADD = -lX11
+

Modified: trunk/printer/yast2-printer.spec.in
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/printer/yast2-printer.spec.in?rev=60172&r1=60171&r2=60172&view=diff
==============================================================================
--- trunk/printer/yast2-printer.spec.in (original)
+++ trunk/printer/yast2-printer.spec.in Tue Dec 22 14:06:29 2009
@@ -2,18 +2,22 @@

@HEADER@

-BuildRequires: cups-devel update-desktop-files yast2 yast2-core-devel
yast2-devtools yast2-testsuite
+BuildRequires: update-desktop-files xorg-x11-libX11-devel yast2
yast2-core-devel yast2-devtools yast2-testsuite

-Recommends: netcat
+Recommends: cups-client netcat samba-client

-Requires: /usr/bin/host cups-libs
+Requires: /bin/mktemp /bin/ping /usr/bin/sed
Requires: yast2 >= 2.16.12

-Provides: yast2-config-cups yast2-agent-printerdb yast2-agent-cups
yast2-lib-printer yast2-config-printer y2c_cups y2c_prnt y2l_printer y2a_cups
y2a_printerdb yast2-trans-printer yast2-trans-libprinter yast2-trans-printerdb
yast2-trans-cups yast2-printerdb-devel yast2-cups-devel
-Obsoletes: yast2-config-cups yast2-agent-printerdb yast2-agent-cups
yast2-lib-printer yast2-config-printer y2c_cups y2c_prnt y2l_printer y2a_cups
y2a_printerdb yast2-trans-printer yast2-trans-libprinter yast2-trans-printerdb
yast2-trans-cups yast2-printerdb-devel yast2-cups-devel
+Provides: yast2-config-cups yast2-agent-cups yast2-lib-printer
yast2-config-printer y2c_cups y2c_prnt y2l_printer y2a_cups yast2-trans-printer
yast2-trans-libprinter yast2-trans-cups yast2-cups-devel
+Obsoletes: yast2-config-cups yast2-agent-cups yast2-lib-printer
yast2-config-printer y2c_cups y2c_prnt y2l_printer y2a_cups yast2-trans-printer
yast2-trans-libprinter yast2-trans-cups yast2-cups-devel

-Provides: yast2-agent-cups-devel yast2-agent-printerdb-devel y2d_prnt
y2t_prnt yast2-db-printer yast2-printerdb
-Obsoletes: yast2-agent-cups-devel yast2-agent-printerdb-devel y2d_prnt
y2t_prnt yast2-db-printer yast2-printerdb
+Provides: yast2-agent-cups-devel y2d_prnt y2t_prnt
+Obsoletes: yast2-agent-cups-devel y2d_prnt y2t_prnt
+
+# Used to exclude libX11, libXau, libxcb, and libxcb-xlib from the requires
list
+# which are pulled in by Autoreqprov because of the basicadd_displaytest tool:
+%define my_requires /tmp/my-requires

Summary: YaST2 - Printer Configuration

@@ -33,6 +37,13 @@
@BUILD@

@INSTALL@
+# Exclude libX11, libXau, libxcb, and libxcb-xlib from the requires list
+# which are pulled in by Autoreqprov because of the basicadd_displaytest tool:
+cat << EOF > %{my_requires}
+grep -v 'basicadd_displaytest' | %{__find_requires}
+EOF
+chmod 755 %{my_requires}
+%define __find_requires %{my_requires}

%post

@@ -61,6 +72,7 @@
@ybindir@/test_remote_novell
@ybindir@/test_remote_smb
@ybindir@/test_remote_socket
+@ybindir@/basicadd_displaytest
#Documentation
%dir @docdir@
@docdir@/COPYING

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages