Module: Yast::PrinterReadwriteInclude

Defined in:
../../src/include/printer/readwrite.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) initialize_printer_readwrite(include_target)



30
31
32
33
34
35
36
37
38
39
40
41
42
# File '../../src/include/printer/readwrite.rb', line 30

def initialize_printer_readwrite(include_target)
  Yast.import "UI"

  textdomain "printer"

  Yast.import "Label"
  Yast.import "Popup"
  Yast.import "Wizard"
  Yast.import "Confirm"
  Yast.import "Printer"

  Yast.include include_target, "printer/helps.rb"
end

- (Object) Modified

Return a modification status

Returns:

  • true if data was modified



46
47
48
# File '../../src/include/printer/readwrite.rb', line 46

def Modified
  Printer.Modified
end

- (Object) PollAbort



71
72
73
# File '../../src/include/printer/readwrite.rb', line 71

def PollAbort
  UI.PollInput == :abort
end

- (Object) ReadDialog

Read settings dialog

Returns:

  • abort if aborted andnext otherwise



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File '../../src/include/printer/readwrite.rb', line 77

def ReadDialog
  # Otherwise the user is asked for confirmation whether he want's to continue
  # despite the fact that the module might not work correctly.
  return :abort if !Confirm.MustBeRoot
  # According to the YaST Style Guide (dated Thu, 06 Nov 2008)
  # the "abort" button in a single configuration dialog must now be named "cancel":
  Wizard.SetAbortButton(:abort, Label.CancelButton)
  # No "back" or "next" button at all makes any sense here
  # because there is no dialog where to go "back"
  # and the "next" dialog (i.e. the Overview dialog) is launced automatically
  Wizard.HideBackButton
  Wizard.HideNextButton
  Wizard.RestoreHelp(Ops.get_string(@HELPS, "read", ""))
  # Printer::AbortFunction = PollAbort;
  ret = Printer.Read
  ret ? :next : :abort
end

- (Object) ReallyAbort

Ask for user confirmation if necessary before aborting. At present full transaction semantics (with roll-back) is not implemented. What is implemented is that it does not leave the system in an inconsistent state. It does one setup completely or not at all (i.e. all or nothing semantics regarding one setup.) "One setup" means the smallest amount of setup actions which lead from one consistent state to another consistent state. "Consistent state" is meant from the user's point of view (i.e. set up one print queue completely or set up printing via network completely) and not from a low-level (e.g. filesystem or kernel) point of view. If the user does malicious stuff (e.g. killing YaST) or if the user ignores warning messages then it is possible (and it is accepted) that the user can force to set up even an inconsistent state (e.g. set up share print queues but don't re-start the cupsd). At present all what is needed for one setup is committed to the system instantly. For background information and details see en.opensuse.org/Archive:YaST_Printer_redesign

Returns:

  • true if nothing was committed or if user confirms to abort



67
68
69
# File '../../src/include/printer/readwrite.rb', line 67

def ReallyAbort
  !Printer.Modified || Popup.ReallyAbort(false)
end

- (Object) WriteDialog

Write settings dialog

Returns:

  • abort if aborted andnext otherwise



97
98
99
100
101
102
103
104
# File '../../src/include/printer/readwrite.rb', line 97

def WriteDialog
  Wizard.HideAbortButton
  Wizard.HideBackButton
  Wizard.HideNextButton
  Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", ""))
  ret = Printer.Write
  ret ? :next : :abort
end