def printoptions(self, widget):
     # problem: The print dialog wants to acquire a lock
     # in older GTK versions.
     # Hence the dialog is shown in a sub-process. 
     
     cmd = ["python", "-c", "exec(%s)" % repr(printerdlg)]
     cfg = self.printconfig.to_string(0)
     p = subprocess.Popen(cmd, 
                          stdin=subprocess.PIPE,
                          stdout=subprocess.PIPE,
                          close_fds=True)
     # writing the current config to the dialog process is pointless:
     # We'll only get the error message "model not found", because
     # of the problem described above... Hell, what a mess
     # We could create a long running process, but that would
     # require to shut it down properly and whatever else -- just to
     # to work around a crazy Gnome bug
     res, err = p.communicate(input=cfg)
     #res, err = p.communicate(input="")
     
     if res:
         print "-------------------------------------"
         print res
         print "-------------------------------------"
         self.printconfig = gnomeprint.config_from_string(res, 0)
         self.printjob = gnomeprint.Job(self.printconfig)
         self.printconfig.dump()
示例#2
0
def my_config_load_from_file():
    try:
	file_ = file(CONFIG_FILE)
    except IOError:
	print "Config not found"
	return gnomeprint.config_default()
    return gnomeprint.config_from_string(file_.read(), 0)
示例#3
0
def my_config_load_from_file():
    try:
        file_ = file(CONFIG_FILE)
    except IOError:
        print "Config not found"
        return gnomeprint.config_default()
    return gnomeprint.config_from_string(file_.read(), 0)