Skip to content

Commit bf88053

Browse files
committed
Offer an embedded mode for system-config-printer
This is used in Mageia for integrating system-config-printer with the Mageia Control Center. It was originally written by Tiago Salem of Mandriva for replacing PrinterDrake in the Mandriva Control Center for Mandriva 2009. It has been mantained by Mageia for successive versions of system-config-printer.
1 parent 1bd2d0f commit bf88053

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

system-config-printer.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def show_help():
5353
"Options:\n\n"
5454
" --debug Enable debugging output.\n"
5555
" --show-jobs <printer> Show the print queue for <printer>\n"
56+
" --embedded Enable to start in Embedded mode.\n "
5657
" --help Show this message.\n")
5758

5859
if len(sys.argv)>1 and sys.argv[1] == '--help':
@@ -100,6 +101,9 @@ def show_help():
100101
iconpath = os.path.join (pkgdata, 'icons/')
101102
sys.path.append (pkgdata)
102103

104+
PlugWindow = None
105+
PlugWindowId = None
106+
103107
def CUPS_server_hostname ():
104108
host = cups.getServer ()
105109
if host[0] == '/':
@@ -205,6 +209,16 @@ def __init__(self):
205209

206210
domain=config.PACKAGE)
207211

212+
if PlugWindowId:
213+
self.PrintersWindow.hide()
214+
# the "vbox4" widget
215+
vbox = self.PrintersWindow.get_children()[0]
216+
PlugWindow = Gtk.Plug.new(PlugWindowId)
217+
Gtk.Container.remove(self.PrintersWindow, vbox)
218+
PlugWindow.add(vbox)
219+
self.PrintersWindow.set_transient_for(PlugWindow)
220+
PlugWindow.show_all()
221+
self.PrintersWindow = PlugWindow
208222

209223
# Since some dialogs are reused we can't let the delete-event's
210224
# default handler destroy them
@@ -2194,7 +2208,8 @@ def main(show_jobs):
21942208
import getopt
21952209
try:
21962210
opts, args = getopt.gnu_getopt (sys.argv[1:], '',
2197-
['debug', 'show-jobs='])
2211+
['embedded=',
2212+
'debug', 'show-jobs='])
21982213
except getopt.GetoptError:
21992214
show_help ()
22002215
sys.exit (1)
@@ -2208,4 +2223,7 @@ def main(show_jobs):
22082223
elif opt == '--show-jobs':
22092224
show_jobs = optarg
22102225

2226+
if opt == "--embedded":
2227+
PlugWindowId = int(optarg)
2228+
22112229
main(show_jobs)

0 commit comments

Comments
 (0)