Back to index

system-config-printer  1.3.9+20120706
Public Member Functions | Public Attributes
troubleshoot.Locale.Locale Class Reference
Inheritance diagram for troubleshoot.Locale.Locale:
Inheritance graph
[legend]
Collaboration diagram for troubleshoot.Locale.Locale:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def display
def collect_answer
def connect_signals
def disconnect_signals
def can_click_forward
def cancel_operation
def initial_vbox
 Helper functions.

Public Attributes

 printer_page_size
 job_page_size
 answers
 troubleshooter

Detailed Description

Definition at line 26 of file Locale.py.


Constructor & Destructor Documentation

def troubleshoot.Locale.Locale.__init__ (   self,
  troubleshooter 
)

Definition at line 27 of file Locale.py.

00027 
00028     def __init__ (self, troubleshooter):
00029         Question.__init__ (self, troubleshooter, "Locale issues")
00030         page = self.initial_vbox (_("Incorrect Page Size"),
00031                                   _("The page size for the print job was "
00032                                     "not the printer's default page size.  "
00033                                     "If this is not intentional it may cause "
00034                                     "alignment problems."))
00035 
00036         table = gtk.Table (2, 2)
00037         table.set_row_spacings (6)
00038         table.set_col_spacings (6)
00039         page.pack_start (table)
00040         self.printer_page_size = gtk.Label ()
00041         self.printer_page_size.set_alignment (0, 0)
00042         self.job_page_size = gtk.Label ()
00043         self.job_page_size.set_alignment (0, 0)
00044         label = gtk.Label (_("Print job page size:"))
00045         label.set_alignment (0, 0)
00046         table.attach (label, 0, 1, 0, 1, xoptions=gtk.FILL, yoptions=0)
00047         table.attach (self.job_page_size, 1, 2, 0, 1,
00048                       xoptions=gtk.FILL, yoptions=0)
00049         label = gtk.Label (_("Printer page size:"))
00050         label.set_alignment (0, 0)
00051         table.attach (label, 0, 1, 1, 2, xoptions=gtk.FILL, yoptions=0)
00052         table.attach (self.printer_page_size, 1, 2, 1, 2,
00053                       xoptions=gtk.FILL, yoptions=0)
00054         troubleshooter.new_page (page, self)

Here is the call graph for this function:


Member Function Documentation

def troubleshoot.base.Question.cancel_operation (   self) [inherited]

Reimplemented from troubleshoot.base.Question.

Definition at line 110 of file Locale.py.

00110 
00111     def collect_answer (self):
00112         return self.answers
00113 
def troubleshoot.base.Question.connect_signals (   self,
  handler 
) [inherited]
Returns True if this page should be displayed, or False
if it should be skipped.

Reimplemented from troubleshoot.base.Question.

Definition at line 55 of file Locale.py.

00055 
00056     def display (self):
00057         self.answers = {}
00058         (messages, encoding) = locale.getlocale (locale.LC_MESSAGES)
00059         (ctype, encoding) = locale.getlocale (locale.LC_CTYPE)
00060         self.answers['user_locale_messages'] = messages
00061         self.answers['user_locale_ctype'] = ctype
00062 
00063         try:
00064             i18n = file ("/etc/sysconfig/i18n").readlines ()
00065             for line in i18n:
00066                 if line.startswith ("LANG="):
00067                     system_lang = line[5:].strip ('\n"')
00068                     dot = system_lang.find ('.')
00069                     if dot != -1:
00070                         system_lang = system_lang[:dot]
00071         except:
00072             system_lang = None
00073 
00074         self.answers['system_locale_lang'] = system_lang
00075 
00076         printer_page_size = None
00077         try:
00078             ppd_defs = self.troubleshooter.answers['cups_printer_ppd_defaults']
00079             for group, options in ppd_defs.iteritems ():
00080                 if options.has_key ("PageSize"):
00081                     printer_page_size = options["PageSize"]
00082                     break
00083 
00084         except KeyError:
00085             try:
00086                 attrs = self.troubleshooter.answers['remote_cups_queue_attributes']
00087                 printer_page_size = attrs["media-default"]
00088             except KeyError:
00089                 pass
00090 
00091         try:
00092             job_status = self.troubleshooter.answers["test_page_job_status"]
00093         except KeyError:
00094             job_status = []
00095 
00096         self.answers['printer_page_size'] = printer_page_size
00097         if printer_page_size != None:
00098             job_page_size = None
00099             for (test, jobid, printer, doc, status, attrs) in job_status:
00100                 if test:
00101                     if attrs.has_key ("PageSize"):
00102                         job_page_size = attrs["PageSize"]
00103                         self.answers['job_page_size'] = job_page_size
00104                         if job_page_size != printer_page_size:
00105                             self.printer_page_size.set_text (printer_page_size)
00106                             self.job_page_size.set_text (job_page_size)
00107                             return True
00108 
00109         return False

def troubleshoot.base.Question.initial_vbox (   self,
  title = '',
  text = '' 
) [inherited]

Helper functions.

Definition at line 66 of file base.py.

00066 
00067     def initial_vbox (self, title='', text=''):
00068         vbox = gtk.VBox ()
00069         vbox.set_border_width (12)
00070         vbox.set_spacing (12)
00071         if title:
00072             s = '<span weight="bold" size="larger">' + title + '</span>\n\n'
00073         else:
00074             s = ''
00075         s += text
00076         label = gtk.Label (s)
00077         label.set_alignment (0, 0)
00078         label.set_line_wrap (True)
00079         label.set_use_markup (True)
00080         vbox.pack_start (label, False, False, 0)
00081         return vbox

Here is the caller graph for this function:


Member Data Documentation

Definition at line 56 of file Locale.py.

Definition at line 41 of file Locale.py.

Definition at line 39 of file Locale.py.

Reimplemented in troubleshoot.CheckPrinterSanity.CheckPrinterSanity.

Definition at line 41 of file base.py.


The documentation for this class was generated from the following file: