Module: Yast::NtpClientDialogsInclude
- Defined in:
- ../../src/include/ntp-client/dialogs.rb
Instance Method Summary (collapse)
-
- (Boolean) abortPopup
Display the popup to confirm abort.
-
- (Symbol) BCastClientDialog
Broadcast client editing dialog.
-
- (Symbol) BCastDialog
Broadcast editing dialog.
-
- (Symbol) FudgeDialog
Fudge factors dialog.
-
- (Object) GetWidgets
Get the map of all widgets.
- - (Object) initialize_ntp_client_dialogs(include_target)
-
- (Symbol) LocalServerSelectionDialog
Dialog for selecting local server from a list.
-
- (Symbol) MainDialog
Main dialog.
-
- (Symbol) PeerDialog
Peer editing dialog.
-
- (Symbol) PublicServerSelectionDialog
Dialog for selecting local server from a list.
-
- (Symbol) RadioDialog
Reference clock editing dialog.
-
- (Object) ReadDialog
Read settings dialog.
-
- (Symbol) SelectConfigType
Select the type of configuration - simple vs.
-
- (Symbol) ServerDialog
Server editing dialog.
-
- (Symbol) SimpleDialog
Main dialog.
-
- (Symbol) SimpleDialogFinish
Pseudo-dialog to store information after the simple dialog.
-
- (Symbol) SimpleDialogPrepare
Pseudo-dialog to fetch information for the simple dialog.
-
- (Symbol) StoreRecord
Pseudo-dialog to store settings to main structure.
-
- (Symbol) TypeSelectDialog
Type of new peer selection dialog.
-
- (Object) WriteDialog
Write settings dialog.
Instance Method Details
- (Boolean) abortPopup
Display the popup to confirm abort
43 44 45 |
# File '../../src/include/ntp-client/dialogs.rb', line 43 def abortPopup Popup.ReallyAbort(true) end |
- (Symbol) BCastClientDialog
Broadcast client editing dialog
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
# File '../../src/include/ntp-client/dialogs.rb', line 513 def BCastClientDialog contents = HBox( HStretch(), VBox(VStretch(), "bccaddress", VStretch()), HStretch() ) # dialog caption caption = _("Incoming Broadcast") CWM.ShowAndRun( { "widget_names" => ["bccaddress"], "widget_descr" => GetWidgets(), "contents" => contents, "caption" => caption, "back_button" => Label.BackButton, "next_button" => Label.OKButton, "fallback_functions" => { :abort => fun_ref(method(:abortPopup), "boolean ()") } } ) end |
- (Symbol) BCastDialog
Broadcast editing dialog
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File '../../src/include/ntp-client/dialogs.rb', line 486 def BCastDialog contents = HBox( HStretch(), VBox(VSpacing(3), "bcaddress", VSpacing(1), "options", VSpacing(3)), HStretch() ) # dialog caption caption = _("Outgoing Broadcast") CWM.ShowAndRun( { "widget_names" => ["bcaddress", "options"], "widget_descr" => GetWidgets(), "contents" => contents, "caption" => caption, "back_button" => Label.BackButton, "next_button" => Label.OKButton, "fallback_functions" => { :abort => fun_ref(method(:abortPopup), "boolean ()") } } ) end |
- (Symbol) FudgeDialog
Fudge factors dialog
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 |
# File '../../src/include/ntp-client/dialogs.rb', line 540 def FudgeDialog contents = HBox( HSpacing(3), VBox( VSpacing(3), HBox( # text entry HWeight(1, TextEntry(Id(:refid), _("&Reference ID"), "")), HSpacing(3), # int field HWeight(1, IntField(Id(:stratum), _("&Stratum"), 0, 15, 2)) ), VStretch(), HBox( # text entry HWeight(1, TextEntry(Id(:time1), _("Calibration Offset 1"))), HSpacing(3), # text entry HWeight(1, TextEntry(Id(:time2), _("Calibration Offset 2"))) ), VStretch(), HBox( # check box HWeight(1, CheckBox(Id(:flag1), _("Flag &1"), false)), HSpacing(3), # check box HWeight(1, CheckBox(Id(:flag2), _("Flag &2"), false)) ), VStretch(), HBox( # check box HWeight(1, CheckBox(Id(:flag3), _("Flag &3"), false)), HSpacing(3), # check box HWeight(1, CheckBox(Id(:flag4), _("Flag &4"), false)) ), VSpacing(3) ), HSpacing(3) ) # dialog caption caption = _("Clock Driver Calibration") Wizard.SetContentsButtons( caption, contents, fudgeHelp, Label.BackButton, Label.NextButton ) = string2opts( Ops.get_string(NtpClient.selected_record, "fudge_options", ""), [ "time1", "time2", "stratum", "refid", "flag1", "flag2", "flag3", "flag4" ], [] ) Builtins.y2error("Options: %1", ) UI.ChangeWidget( Id(:refid), :Value, Ops.get_string(, ["parsed", "refid"], "") ) UI.ChangeWidget( Id(:stratum), :Value, Builtins.tointeger(Ops.get_string(, ["parsed", "stratum"], "3")) ) UI.ChangeWidget( Id(:time1), :Value, Ops.get_string(, ["parsed", "time1"], "") ) UI.ChangeWidget( Id(:time2), :Value, Ops.get_string(, ["parsed", "time2"], "") ) UI.ChangeWidget( Id(:flag1), :Value, Ops.get_string(, ["parsed", "flag1"], "") == "1" ) UI.ChangeWidget( Id(:flag2), :Value, Ops.get_string(, ["parsed", "flag2"], "") == "1" ) UI.ChangeWidget( Id(:flag3), :Value, Ops.get_string(, ["parsed", "flag3"], "") == "1" ) UI.ChangeWidget( Id(:flag4), :Value, Ops.get_string(, ["parsed", "flag4"], "") == "1" ) UI.ChangeWidget(Id(:time1), :ValidChars, "1234567890.") UI.ChangeWidget(Id(:time2), :ValidChars, "1234567890.") ret = nil while ret == nil ret = UI.UserInput end ret = :abort if ret == :cancel return Convert.to_symbol(ret) if ret == :back || ret == :abort if ret == :next Ops.set( , ["parsed", "refid"], UI.QueryWidget(Id(:refid), :Value) ) Ops.set( , ["parsed", "stratum"], UI.QueryWidget(Id(:stratum), :Value) ) Ops.set( , ["parsed", "time1"], UI.QueryWidget(Id(:time1), :Value) ) Ops.set( , ["parsed", "time2"], UI.QueryWidget(Id(:time2), :Value) ) Ops.set( , ["parsed", "flag1"], Convert.to_boolean(UI.QueryWidget(Id(:flag1), :Value)) ? 1 : 0 ) Ops.set( , ["parsed", "flag2"], Convert.to_boolean(UI.QueryWidget(Id(:flag2), :Value)) ? 1 : 0 ) Ops.set( , ["parsed", "flag3"], Convert.to_boolean(UI.QueryWidget(Id(:flag3), :Value)) ? 1 : 0 ) Ops.set( , ["parsed", "flag4"], Convert.to_boolean(UI.QueryWidget(Id(:flag4), :Value)) ? 1 : 0 ) Ops.set( NtpClient.selected_record, "fudge_options", opts2string( Ops.get_map(, "parsed", {}), Ops.get_string(, "unknown", "") ) ) end Convert.to_symbol(ret) end |
- (Object) GetWidgets
Get the map of all widgets
36 37 38 39 |
# File '../../src/include/ntp-client/dialogs.rb', line 36 def GetWidgets @widgets = InitWidgets() if @widgets == nil deep_copy(@widgets) end |
- (Object) initialize_ntp_client_dialogs(include_target)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File '../../src/include/ntp-client/dialogs.rb', line 13 def initialize_ntp_client_dialogs(include_target) textdomain "ntp-client" Yast.import "CWM" Yast.import "CWMTab" Yast.import "Label" Yast.import "NtpClient" Yast.import "Popup" Yast.import "Stage" Yast.import "SuSEFirewall" Yast.import "Wizard" Yast.import "Report" Yast.import "Confirm" Yast.include include_target, "ntp-client/misc.rb" Yast.include include_target, "ntp-client/widgets.rb" @widgets = nil end |
- (Symbol) LocalServerSelectionDialog
Dialog for selecting local server from a list
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File '../../src/include/ntp-client/dialogs.rb', line 320 def LocalServerSelectionDialog = CWM.CreateWidgets( ["found_servers", "select_test_local"], GetWidgets() ) contents = HBox( HSpacing(1), VBox( Frame( # TRANSLATORS: frame label _("Local NTP Server"), VBox( VSpacing(1), Ops.get_term(, [0, "widget"], Empty()), VSpacing(1), Ops.get_term(, [1, "widget"], Empty()) ) ), VSpacing(1), ButtonBox( PushButton(Id(:next), Label.OKButton), PushButton(Id(:back), Label.CancelButton) ) ), HSpacing(1) ) UI.OpenDialog(Opt(:decorated), contents) ret = CWM.Run( , { :abort => fun_ref(method(:abortPopup), "boolean ()"), :ok => true, :back => false } ) UI.CloseDialog ret end |
- (Symbol) MainDialog
Main dialog
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File '../../src/include/ntp-client/dialogs.rb', line 141 def MainDialog NtpClient.simple_dialog = false tab1 = HBox( HSpacing(1), VBox( VSpacing(1), HBox( VBox( "start", VSpacing(), HBox("policy_combo", "custom_policy"), VSpacing(), "interval", VSpacing() ) ), VSpacing(1), "overview", VSpacing(1) ), HSpacing(1) ) tab2 = HBox( HSpacing(1), VBox( VSpacing(1), HBox( VBox( Left("run_chroot"), VSpacing(), Left("secure"), VSpacing(), Frame( # TRANSLATORS: UI frame label _("Firewall Settings"), "firewall" ) ) ), VStretch() ), HSpacing(1) ) tabs = { "general" => { "header" => _("General Settings"), "contents" => tab1, "widget_names" => [ "start", "policy_combo", "custom_policy", "interval", "overview" ] }, "security" => { "header" => _("Security Settings"), "contents" => tab2, "widget_names" => ["run_chroot", "secure", "firewall"] } } wd = { "tab" => CWMTab.CreateWidget( { "tab_order" => ["general", "security"], "tabs" => tabs, "widget_descr" => GetWidgets(), "initial_tab" => "general", "tab_help" => "" } ) } contents = VBox("tab") w = CWM.CreateWidgets( ["tab"], Convert.convert( wd, :from => "map <string, any>", :to => "map <string, map <string, any>>" ) ) # dialog caption caption = _("Advanced NTP Configuration") help = CWM.MergeHelps(w) contents = CWM.PrepareDialog(contents, w) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Stage.initial ? Label.AcceptButton : Label.OKButton ) Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) #CWM::handleWidgets (w, $["ID" : "never"]); CWM.Run( w, { :abort => fun_ref(method(:reallyExitComplex), "boolean ()") } ) end |
- (Symbol) PeerDialog
Peer editing dialog
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
# File '../../src/include/ntp-client/dialogs.rb', line 412 def PeerDialog contents = HBox( HStretch(), VBox(VSpacing(3), "paddress", VSpacing(1), "options", VSpacing(3)), HStretch() ) # dialog caption caption = _("NTP Peer") CWM.ShowAndRun( { "widget_names" => ["paddress", "options"], "widget_descr" => GetWidgets(), "contents" => contents, "caption" => caption, "back_button" => Label.BackButton, "next_button" => Label.OKButton, "fallback_functions" => { :abort => fun_ref(method(:abortPopup), "boolean ()") } } ) end |
- (Symbol) PublicServerSelectionDialog
Dialog for selecting local server from a list
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File '../../src/include/ntp-client/dialogs.rb', line 366 def PublicServerSelectionDialog = CWM.CreateWidgets( ["servers_list", "select_test_public"], GetWidgets() ) contents = HBox( HSpacing(1), VBox( Frame( # TRANSLATORS: frame label _("Public NTP Server"), VBox( VSpacing(1), Ops.get_term(, [0, "widget"], Empty()), VSpacing(1), Ops.get_term(, [1, "widget"], Empty()) ) ), VSpacing(1), ButtonBox( PushButton(Id(:next), Label.OKButton), PushButton(Id(:back), Label.CancelButton) ) ), HSpacing(1) ) UI.OpenDialog(Opt(:decorated), contents) ret = CWM.Run( , { :abort => fun_ref(method(:abortPopup), "boolean ()"), :ok => true, :back => false } ) UI.CloseDialog ret end |
- (Symbol) RadioDialog
Reference clock editing dialog
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File '../../src/include/ntp-client/dialogs.rb', line 439 def RadioDialog contents = HBox( HSpacing(3), VBox( VSpacing(0.5), HBox("clock_type", HStretch()), HBox("unit_number", HStretch()), VSpacing(0.5), HBox("create_symlink", HStretch()), HBox("device", VBox(Label(""), "browse"), HStretch()), VSpacing(0.5), "options", VSpacing(0.5), "fudge_button", VSpacing(1) ), HSpacing(3) ) # dialog caption caption = _("Local Reference Clock") CWM.ShowAndRun( { "widget_names" => [ "clock_type", "unit_number", "create_symlink", "device", "browse", "options", "fudge_button" ], "widget_descr" => GetWidgets(), "contents" => contents, "caption" => caption, "back_button" => Label.BackButton, "next_button" => Label.OKButton, "fallback_functions" => { :abort => fun_ref(method(:abortPopup), "boolean ()") } } ) end |
- (Object) ReadDialog
Read settings dialog
49 50 51 52 53 54 55 56 57 58 59 |
# File '../../src/include/ntp-client/dialogs.rb', line 49 def ReadDialog Wizard.RestoreHelp(Ops.get_string(@HELPS, "read", "")) # checking for root permissions (#158483) return :abort if !Stage.initial && !Confirm.MustBeRoot NtpClient.AbortFunction = fun_ref(method(:PollAbort), "boolean ()") ret = NtpClient.Read NtpClient.AbortFunction = nil ret ? :next : :abort end |
- (Symbol) SelectConfigType
Select the type of configuration - simple vs. complex
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 |
# File '../../src/include/ntp-client/dialogs.rb', line 747 def SelectConfigType if NtpClient.PolicyIsNonstatic Builtins.y2milestone("Netconfig nonstatic configuration") return :complex end peers = NtpClient.getSyncRecords servers = Builtins.filter(peers) do |m| Ops.get_string(m, "type", "") == "server" end clocks = Builtins.filter(peers) do |m| Ops.get_string(m, "type", "") == "__clock" end random_pool_servers_enabled_only = # number of listed servers is the same as the needed servers for random_pool_servers function Builtins.size(servers) == Builtins.size(NtpClient.random_pool_servers) && # enabled means that all of needed servers are listed NtpClient.IsRandomServersServiceEnabled if Builtins.size(peers) != Ops.add(Builtins.size(servers), Builtins.size(clocks)) Builtins.y2milestone("Something else than server and clock present") return :complex end if random_pool_servers_enabled_only && Ops.less_or_equal(Builtins.size(clocks), 1) Builtins.y2milestone("Simple settings with random_pool_servers") return :simple end if Ops.greater_than(Builtins.size(servers), 1) || Ops.greater_than(Builtins.size(clocks), 1) Builtins.y2milestone( "More than one server or more than one clock present" ) return :complex end clock_addr = Ops.get_string(clocks, [0, "address"], "") if "127.127.1.0" != clock_addr && "" != clock_addr Builtins.y2milestone("Non-standard clock present") return :complex end Builtins.y2milestone("Going simple dialog") :simple end |
- (Symbol) ServerDialog
Server editing dialog
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File '../../src/include/ntp-client/dialogs.rb', line 279 def ServerDialog contents = HBox( HStretch(), VBox( VSpacing(2), Frame( _("Server Settings"), VBox( "server_address", VSpacing(0.5), "options", VSpacing(0.5), "ac_options", VSpacing(0.5) ) ), VSpacing(2) ), HStretch() ) # dialog caption caption = _("NTP Server") CWM.ShowAndRun( { "widget_names" => ["server_address", "options", "ac_options"], "widget_descr" => GetWidgets(), "contents" => contents, "caption" => caption, "back_button" => Label.BackButton, "next_button" => Label.OKButton, "fallback_functions" => { :abort => fun_ref(method(:abortPopup), "boolean ()") } } ) end |
- (Symbol) SimpleDialog
Main dialog
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File '../../src/include/ntp-client/dialogs.rb', line 75 def SimpleDialog NtpClient.simple_dialog = true w = CWM.CreateWidgets( [ "start", "interval", "server_address", "use_random_servers", "complex_button" ], GetWidgets() ) contents = HBox( HSpacing(1), VBox( VStretch(), HBox(HStretch(), "start", HStretch()), VStretch(), "interval", VStretch(), HBox( HStretch(), Frame( # frame label _("NTP Server Configuration"), VBox(Left("use_random_servers"), "server_address") ), HStretch() ), VStretch(), "complex_button", VStretch() ), HSpacing(1) ) # dialog caption caption = _("NTP Configuration") help = CWM.MergeHelps(w) contents = CWM.PrepareDialog(contents, w) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Stage.initial ? Label.AcceptButton : Label.OKButton ) Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) startInit(nil) CWM.handleWidgets(w, { "ID" => "never" }) ret = CWM.Run( w, # yes-no popup { :abort => fun_ref(method(:reallyExitSimple), "boolean ()") } ) Builtins.y2milestone("Simple dialog: Returning %1", ret) ret end |
- (Symbol) SimpleDialogFinish
Pseudo-dialog to store information after the simple dialog
728 729 730 731 732 733 |
# File '../../src/include/ntp-client/dialogs.rb', line 728 def SimpleDialogFinish if Ops.get_string(NtpClient.selected_record, "address", "") != "" NtpClient.storeSyncRecord end :next end |
- (Symbol) SimpleDialogPrepare
Pseudo-dialog to fetch information for the simple dialog
715 716 717 718 719 720 721 722 723 |
# File '../../src/include/ntp-client/dialogs.rb', line 715 def SimpleDialogPrepare peers = NtpClient.getSyncRecords servers = Builtins.filter(peers) do |m| Ops.get_string(m, "type", "") == "server" end index = Ops.get_integer(servers, [0, "index"], -1) NtpClient.selectSyncRecord(index) :next end |
- (Symbol) StoreRecord
Pseudo-dialog to store settings to main structure
739 740 741 742 743 |
# File '../../src/include/ntp-client/dialogs.rb', line 739 def StoreRecord @sync_record_modified = true NtpClient.storeSyncRecord :next end |
- (Symbol) TypeSelectDialog
Type of new peer selection dialog
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File '../../src/include/ntp-client/dialogs.rb', line 252 def TypeSelectDialog contents = HBox( HStretch(), VBox(VSpacing(3), "peer_types", VSpacing(3)), HStretch() ) # dialog caption caption = _("New Synchronization") CWM.ShowAndRun( { "widget_names" => ["peer_types"], "widget_descr" => GetWidgets(), "contents" => contents, "caption" => caption, "back_button" => Label.BackButton, "next_button" => Label.NextButton, "fallback_functions" => { :abort => fun_ref(method(:abortPopup), "boolean ()") } } ) end |
- (Object) WriteDialog
Write settings dialog
63 64 65 66 67 68 69 70 71 |
# File '../../src/include/ntp-client/dialogs.rb', line 63 def WriteDialog return :next if Stage.initial Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", "")) NtpClient.AbortFunction = fun_ref(method(:PollAbort), "boolean ()") ret = NtpClient.Write NtpClient.AbortFunction = nil ret ? :next : :abort end |