Module: Yast::ProductCreatorDialogsInclude
- Defined in:
- ../../src/include/product-creator/dialogs.rb
Instance Method Summary (collapse)
- - (Object) AskArch(label, archs, preselected)
- - (Object) autoyastPackages
- - (Object) baseProductSelectionDialog
- - (Object) CheckArchitecture(_SrcID)
-
- (void) ConfigSummary
Configuration Summary.
-
- (Object) Configure1Dialog
General configuration dialog.
-
- (Object) Configure2Dialog
Configure2 dialog.
-
- (Object) createTableItem(source, selectable, media_filter)
Create a table item from a map as returned by the InstSrcManager agent.
-
- (Object) detailedSelection(mode)
Start the detailed package selection.
-
- (Array) fillSourceTable(sources, selectable, media_filter)
Fill sources table with entries from the InstSrcManager agent.
- - (Object) GpgDialogContent
- - (Object) gpgKeyDialog
- - (Object) initialize_product_creator_dialogs(include_target)
- - (Object) InstallPackageOrProvider(p)
-
- (Object) InstallPackageOrProviderVersion(p, version)
Select package for installation.
-
- (Object) isolinuxDialog
Configure3 dialog.
-
- (Symbol) packageSelector
Select packages.
-
- (Object) patternSelection
Start the pattern selection dialog.
- - (Object) ProductFromRepo(repo_id)
- - (Object) ProductFromURL(url)
- - (Object) refreshSigningDialog(sign)
-
- (Hash{String => Object}) runPackageSelector(base_pattern, patterns, packages, taboo, mode)
Display package selection dialog with preselected packages.
-
- (Object) runPackageSelectorVersions(base_pattern, patterns, packages, versions, taboo, mode)
Display package selection dialog with preselected packages.
- - (Object) sign_checkbox_widget
- - (Object) signCheckboxInit(key)
- - (Object) SignContent(key, event)
-
- (Symbol) sourceDialog
Dialog for selecting the sources.
Instance Method Details
- (Object) AskArch(label, archs, preselected)
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 |
# File '../../src/include/product-creator/dialogs.rb', line 601 def AskArch(label, archs, preselected) archs = deep_copy(archs) = VBox() = VBox() max_lines = 6 if !Builtins.contains(archs, preselected) Builtins.y2warning( "The preselected architecture is missing in the list!" ) # add the missing preselected arch archs = Builtins.prepend(archs, preselected) end archsz = Builtins.size(archs) col1num = Ops.greater_than(archsz, max_lines) ? Ops.divide(Ops.add(archsz, 1), 2) : archsz Builtins.y2milestone("Number of archs in the first column: %1", col1num) # preselect the first item Builtins.foreach(archs) do |a| if Ops.greater_than(col1num, 0) = Builtins.add( , MinWidth(10, Left(RadioButton(Id(a), a, a == preselected))) ) else = Builtins.add( , MinWidth(10, Left(RadioButton(Id(a), a, a == preselected))) ) end col1num = Ops.subtract(col1num, 1) end content = MarginBox( 1, 0.5, VBox( Label(label), VSpacing(1), Frame( _("Target Architecture"), RadioButtonGroup( Id(:rb), HBox(Top(), HStretch(), Top(), HStretch()) ) ), VSpacing(1), HBox( HSpacing(Opt(:hstretch), 2), HWeight(1, PushButton(Id(:ok), Label.OKButton)), HSpacing(2), HWeight(1, PushButton(Id(:cancel), Label.CancelButton)), HSpacing(Opt(:hstretch), 2) ) ) ) UI.OpenDialog(content) ui = UI.UserInput ret = Convert.to_string(UI.QueryWidget(Id(:rb), :CurrentButton)) UI.CloseDialog if ui == :cancel || ui == :close # canceled return nil elsif ui == :ok Builtins.y2milestone("Selected architecture: %1", ret) return ret else Builtins.y2error("Unhandled user input %1", ui) return nil end end |
- (Object) autoyastPackages
1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 |
# File '../../src/include/product-creator/dialogs.rb', line 1293 def autoyastPackages base_selection = "" #Pkg::TargetFinish (); Popup.ShowFeedback( _("Reading data from Package Database..."), _("Please wait...") ) Pkg.TargetFinish tmp = Convert.to_string(SCR.Read(path(".target.tmpdir"))) SCR.Execute(path(".target.mkdir"), Ops.add(tmp, "/tmproot")) Pkg.TargetInit(Ops.add(tmp, "/tmproot"), true) success = ProductCreator.EnableSource # Pkg::SourceStartManager(true); if Ops.get_string(ProductCreator.Config, "profile", "") != "" && !ProductCreator.profile_parsed if !ProductCreator.readControlFile( Ops.get_string(ProductCreator.Config, "profile", "") ) return :overview end # set the new selection Builtins.y2debug("Config: %1", ProductCreator.Config) if Ops.get_symbol(ProductCreator.Config, "type", :unknown) == :patterns base_pat = Ops.get_string(ProductCreator.Config, "base", "") if Ops.greater_than(Builtins.size(base_pat), 0) Pkg.ResolvableInstall(base_pat, :pattern) Builtins.y2milestone("Selecting pattern: %1", base_pat) end if Ops.greater_than( Builtins.size(Ops.get_list(ProductCreator.Config, "addons", [])), 0 ) Builtins.foreach(Ops.get_list(ProductCreator.Config, "addons", [])) do |addon| Pkg.ResolvableInstall(addon, :pattern) Builtins.y2milestone("Selecting pattern: %1", addon) end end else Builtins.y2warning( "Unsupported software selection type: %1", Ops.get_symbol(ProductCreator.Config, "type", :unknown) ) end if Ops.greater_than( Builtins.size(Ops.get_list(ProductCreator.Config, "packages", [])), 0 ) versions = Builtins.listmap( Ops.get_list(ProductCreator.Config, "package_versions", []) ) do |p| { Ops.get_string(p, "name", "") => Ops.get_string(p, "version", "") } end Builtins.foreach(Ops.get_list(ProductCreator.Config, "packages", [])) do |p| version = Ops.get(versions, p, "") if version != "" Builtins.y2milestone( "selecting package for installation: %1 (%2) -> %3", p, version, InstallPackageOrProviderVersion(p, version) ) else Builtins.y2milestone( "selecting package for installation: %1 -> %2", p, Pkg.PkgInstall(p) ) end end end # mark taboo packages ProductCreator.MarkTaboo( Ops.get_list(ProductCreator.Config, "taboo", []) ) Pkg.PkgSolve(true) allpacs = Pkg.GetPackages(:selected, true) Builtins.y2milestone( "All packages: %1 ( %2 )", allpacs, Builtins.size(allpacs) ) end Popup.ClearFeedback :next end |
- (Object) baseProductSelectionDialog
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 |
# File '../../src/include/product-creator/dialogs.rb', line 1109 def baseProductSelectionDialog if Builtins.size(Ops.get_list(ProductCreator.Config, "sources", [])) == 1 # there is just one repository, we can skip this dialog Builtins.y2milestone( "Only one repository selected, skipping base repository selection" ) # remove the option if it exists if Builtins.haskey(ProductCreator.Config, "base_repo") ProductCreator.Config = Builtins.remove( ProductCreator.Config, "base_repo" ) end ret2 = @going_back ? :back : :next if ret2 == :next Ops.set( ProductCreator.Config, "product", ProductFromURL( Ops.get(Ops.get_list(ProductCreator.Config, "sources", []), 0, "") ) ) end return ret2 end # dialog caption caption = _("Base Source Selection") base_url = Ops.get_string(ProductCreator.Config, "base_repo", "") Builtins.y2milestone("Base product: %1", base_url) # convert the URL to Id default_base = Ops.get(ProductCreator.UrlToId([base_url]), 0, -1) if Ops.less_than(default_base, 0) Builtins.y2milestone("The base repository is unknown, proposing...") default_base = ProductCreator.checkProductDependency end default_url = Ops.get_string( Pkg.SourceGeneralData(default_base), "url", "" ) items = [] Builtins.foreach(Ops.get_list(ProductCreator.Config, "sources", [])) do |srcurl| items = Builtins.add(items, Item(srcurl, srcurl == default_url)) end contents = SelectionBox( Id(:base_selection), _("Selected Base Source"), items ) Wizard.SetContentsButtons( caption, contents, Ops.get_string(@HELPS, "baseSelection", ""), Label.BackButton, Label.NextButton ) ret = :again base = "" while !Builtins.contains([:next, :back, :abort], ret) ret = Convert.to_symbol(UI.UserInput) if ret == :next # get the selected source base = Convert.to_string( UI.QueryWidget(Id(:base_selection), :CurrentItem) ) Builtins.y2internal("Selected base product: %1", base) base_src_id = Ops.get(ProductCreator.UrlToId([base]), 0, -1) boot_info = ProductCreator.GetBootInfoRepo(base_src_id) bootable = Ops.get_boolean(boot_info, "bootable", false) # is the base source bootable? if !bootable Builtins.y2warning("Selected base product is not bootable") if !Popup.ContinueCancel( "The selected base repository doesn't contain /boot directory.\nThe created medium will not be bootable.\n" ) ret = :again end end end ret = :abort if ret == :close end if ret == :next Ops.set(ProductCreator.Config, "base_repo", base) Ops.set(ProductCreator.Config, "product", ProductFromURL(base)) end ret end |
- (Object) CheckArchitecture(_SrcID)
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 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 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 791 792 793 794 795 |
# File '../../src/include/product-creator/dialogs.rb', line 683 def CheckArchitecture(_SrcID) general_info = Pkg.SourceGeneralData(_SrcID) Builtins.y2milestone( "Checking architecture of repository %1", general_info ) found_architecture = false found_archs = [] arch = ProductCreator.GetPackageArch arch = ProductCreator.GetArch if arch == nil arch = "s390x" if arch == "s390_64" type = Ops.get_string(general_info, "type", "") # if the type is missing then probe it now if type == "NONE" type = Pkg.RepositoryProbe( Ops.get_string(general_info, "url", ""), Ops.get_string(general_info, "product_dir", "/") ) Builtins.y2milestone("Probed repository type: %1", type) end # architecture check is possible only for YaST sources if type == "YaST" # Check architecture read_content = ProductCreator.ReadContentFile(_SrcID) Builtins.y2milestone("content file: %1", read_content) Builtins.foreach(read_content) do |key, value| if key == Ops.add("ARCH.", arch) found_architecture = true raise Break end if key == "BASEARCHS" Builtins.y2milestone("BASEARCHS: %1", value) arch_list = Builtins.splitstring(value, " ") arch_list = Builtins.filter(arch_list) { |a| a != nil && a != "" } Builtins.y2milestone("Found architectures: %1", arch_list) if Builtins.contains(arch_list, arch) found_architecture = true raise Break else found_archs = Convert.convert( Builtins.union(found_archs, arch_list), :from => "list", :to => "list <string>" ) end else found_arch = Builtins.regexpsub(key, "ARCH\\.(.*)", "\\1") if found_arch != nil found_archs = Builtins.add(found_archs, found_arch) end end end else Builtins.y2milestone( "Not a YaST source, cannot verify the architecture" ) found_architecture = true end Builtins.y2milestone( "Architecture %1 is supported: %2", arch, found_architecture ) if found_architecture return true else Builtins.y2milestone("Supported architectures: %1", found_archs) if Builtins.size(found_archs) == 0 Builtins.y2milestone( "The repository does not provide architecture data, assuming it is compatible" ) return true end # the architecture is different, ask to switch it # %1 is URL of the repository # %2 is name of the architecture (like i386, x86_64, ppc...) new_arch = AskArch( Builtins.sformat( _( "Source %1\n" + "does not support the current target architecture (%2).\n" + "Change the target architecture?\n" ), Ops.get_string(general_info, "url", ""), ProductCreator.GetArch ), found_archs, Ops.get(found_archs, 0, "") ) # nil == switch has been canceled if new_arch != nil # change the architecture ProductCreator.SetPackageArch(new_arch) return true end end false end |
- (void) ConfigSummary
This method returns an undefined value.
Configuration Summary
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 |
# File '../../src/include/product-creator/dialogs.rb', line 1891 def ConfigSummary Yast.import "Summary" Wizard.CreateDialog Wizard.SetDesktopTitleAndIcon("product-creator") caption = _("Configuration Summary") Wizard.SetContents(caption, Empty(), "", false, false) ProductCreator.CommitConfig summary = "" # summary caption summary = Summary.AddHeader(summary, _("Package Source")) summary = Summary.OpenList(summary) Builtins.foreach(Ops.get_list(ProductCreator.Config, "sources", [])) do |s| summary = Summary.AddListItem(summary, s) end summary = Summary.CloseList(summary) # summary caption summary = Summary.AddHeader(summary, _("Packages")) # summary line summary = Summary.AddLine( summary, Builtins.sformat( _("Selected %1 packages"), Builtins.size(Pkg.GetPackages(:selected, true)) ) ) arch = Ops.get_string(ProductCreator.Config, "arch", "") # display the architecture in the summary if it has been changed if arch != nil && arch != "" && arch != Arch.architecture summary = Summary.AddHeader(summary, _("Architecture")) # summary line, %1 is e.g. i386, x86_64, ppc... summary = Summary.AddLine( summary, Builtins.sformat(_("Target architecture: %1"), arch) ) end # summary caption summary = Summary.AddHeader(summary, _("Output Directory")) if Ops.get_string(ProductCreator.Config, "result", "tree") == "iso" summary = Summary.AddLine( summary, # summary line (%1/%2 is file path) Builtins.sformat( _("Creating ISO image %1/%2"), Ops.get_string(ProductCreator.Config, "iso-directory", ""), Ops.get_string(ProductCreator.Config, "isofile", "") ) ) else summary = Summary.AddLine( summary, # summary line (%1/%2 is file path) Builtins.sformat( _("Creating directory tree in <b> %1/%2 </b>"), Ops.get_string(ProductCreator.Config, "iso-directory", ""), Ops.get_string(ProductCreator.Config, "name", "") ) ) end # header in the summary dialog summary = Summary.AddHeader(summary, _("Signing")) gpgkey = Ops.get_string(ProductCreator.Config, "gpg_key", "") if gpgkey != "" privatekeys = GPG.PrivateKeys uid = "" Builtins.foreach(privatekeys) do |key| if Ops.get_string(key, "id", "") == gpgkey uid = Builtins.mergestring(Ops.get_list(key, "uid", []), ", ") end end uid = Builtins.sformat(" (%1)", uid) if uid != "" # summary text - %1 is GPG key ID (e.g. ABCDEF01), %2 is GPG key user ID (or empty if not defined) summary = Summary.AddLine( summary, Builtins.sformat( _("Digitally sign the medium with GPG key <b>%1</b>%2"), gpgkey, String.EscapeTags(uid) ) ) else # summary text summary = Summary.AddLine( summary, _("The medium will not be digitally signed") ) end contents = RichText(summary) help_text = _( "<p>Verify the data in the summary then press Next to continue.\n</p>\n" ) Wizard.SetContentsButtons( caption, contents, help_text, Label.BackButton, Label.FinishButton ) ret = nil begin ret = UI.UserInput if ret == :abort && !ProductCreator.ReallyAbort # abort canceled ret = :dummy end end until ret == :next || ret == :back || ret == :abort Wizard.CloseDialog Convert.to_symbol(ret) end |
- (Object) Configure1Dialog
General configuration dialog
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 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 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 317 318 319 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 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File '../../src/include/product-creator/dialogs.rb', line 166 def Configure1Dialog # ProductCreator configure1 dialog caption caption = _("Product Creator Configuration") name = Ops.get_string(ProductCreator.Config, "name", "") pkgtype = Ops.get_string( ProductCreator.Config, "pkgtype", "package-manager" ) # Autoyast profile = Ops.get_string(ProductCreator.Config, "profile", "") copy_profile = Ops.get_boolean( ProductCreator.Config, "copy_profile", false ) # List plain_list = Ops.get_string(ProductCreator.Config, "package-list", "") c2 = HBox( HWeight(10, Empty()), HWeight( 80, VBox( VSquash( HBox( InputField( Id(:profile_loc), Opt(:hstretch), # text entry label _("Profile Loca&tion:"), profile ), VBox( VSpacing(), Bottom( # push button label PushButton(Id(:open_profile), _("Select Fi&le")) ) ) ) ), Left( CheckBox( Id(:copyprofile), # check box label _("Copy Profile to CD I&mage"), copy_profile ) ) ) ) ) v = VBox( # radio button label Left( RadioButton( Id(:pkgmgr), Opt(:notify), _("Pac&kage Manager"), pkgtype == "package-manager" ) ), # radio button label Left( RadioButton( Id(:autoyast), Opt(:notify), _("&AutoYaST Control File"), pkgtype == "autoyast" ) ), c2 ) sources = [] # ProductCreator::GetDirSources(source); # ProductCreator configure1 dialog contents contents = HVSquash( VBox( InputField( Id(:name), Opt(:hstretch), # text entry label _("&Configuration Name:"), name ), # frame label Frame(_("Packages"), VBox(RadioButtonGroup(Id(:pkg), v))) ) ) Wizard.SetContentsButtons( caption, contents, Ops.get_string(@HELPS, "initial", ""), Label.BackButton, Label.NextButton ) ret = nil rb = :none while true rb = Convert.to_symbol(UI.QueryWidget(Id(:pkg), :CurrentButton)) if rb == :autoyast UI.ChangeWidget(Id(:profile_loc), :Enabled, true) UI.ChangeWidget(Id(:open_profile), :Enabled, true) UI.ChangeWidget(Id(:copyprofile), :Enabled, true) elsif rb == :plain UI.ChangeWidget(Id(:profile_loc), :Enabled, false) UI.ChangeWidget(Id(:open_profile), :Enabled, false) UI.ChangeWidget(Id(:copyprofile), :Enabled, false) else UI.ChangeWidget(Id(:profile_loc), :Enabled, false) UI.ChangeWidget(Id(:open_profile), :Enabled, false) UI.ChangeWidget(Id(:copyprofile), :Enabled, false) end ret = UI.UserInput # abort? if ret == :abort || ret == :cancel if ProductCreator.ReallyAbort break else next end elsif ret == :next # set architecture if configured arch = Ops.get_string(ProductCreator.Config, "arch", "") ProductCreator.SetPackageArch(arch) if arch != nil && arch != "" name2 = Convert.to_string(UI.QueryWidget(Id(:name), :Value)) if name2 == "" Report.Error(_("Enter the name of the configuration.")) next end if Builtins.haskey(ProductCreator.Configs, name2) && Ops.get_string(ProductCreator.Config, "name", "") != name2 Report.Error( _( "A configuration with this name already exists.\n Select a new name.\n" ) ) next end Ops.set( ProductCreator.Config, "old_name", Ops.get_string(ProductCreator.Config, "name", "") ) Ops.set(ProductCreator.Config, "name", name2) if rb == :autoyast profile_loc = Convert.to_string( UI.QueryWidget(Id(:profile_loc), :Value) ) if !FileUtils.Exists(profile_loc) # error message Report.Error( Builtins.sformat( _("The file '%1' does not exist. Choose a correct one."), profile_loc ) ) next end Ops.set(ProductCreator.Config, "pkgtype", "autoyast") Ops.set(ProductCreator.Config, "profile", profile_loc) Ops.set( ProductCreator.Config, "copy_profile", Convert.to_boolean(UI.QueryWidget(Id(:copyprofile), :Value)) ) else Ops.set(ProductCreator.Config, "pkgtype", "package-manager") end ProductCreator.modified = true ProductCreator.profile_parsed = false break elsif ret == :back break elsif ret == :open_profile new_file = UI.AskForExistingFile( ProductCreator.AYRepository, "*", _("Select File") ) if new_file != nil UI.ChangeWidget( Id(:profile_loc), :Value, Convert.to_string(new_file) ) end next else if ret != :autoyast && ret != :pkgmgr Builtins.y2error("unexpected retcode: %1", ret) end next end end Convert.to_symbol(ret) end |
- (Object) Configure2Dialog
Configure2 dialog
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 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 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 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 |
# File '../../src/include/product-creator/dialogs.rb', line 392 def Configure2Dialog # ProductCreator configure2 dialog caption caption = _("Product Creator Configuration") dirtree = Ops.get_string(ProductCreator.Config, "iso-directory", "") publisher = Ops.get_string(ProductCreator.Config, "publisher", "") preparer = Ops.get_string(ProductCreator.Config, "preparer", "") result = Ops.get_string(ProductCreator.Config, "result", "iso") isofile_path = Ops.get_string(ProductCreator.Config, "isofile", "") savespace = Ops.get_boolean(ProductCreator.Config, "savespace", false) if isofile_path == "" isofile_path = Ops.add( Ops.get_string(ProductCreator.Config, "name", ""), ".iso" ) end # ProductCreator configure2 dialog contents contents = HVSquash( VBox( # frame label Frame( _("Output:"), VBox( VSquash( HBox( InputField( Id(:dirtree), Opt(:hstretch), # text entry label _("&Path to Generated Directory Tree:"), dirtree ), VBox( VSpacing(), Bottom( # push button label PushButton(Id(:open_dir), _("&Select Directory")) ) ) ) ), RadioButtonGroup( Id(:result), VBox( Left( RadioButton( Id(:isofile), Opt(:notify), # radio button label _("&Generate ISO Image File"), result == "iso" ) ), HBox( HWeight(10, Empty()), HWeight( 80, VBox( HBox( HWeight( 2, InputField( Id(:isofile_path), Opt(:hstretch), # text entry label _("&ISO Image File:"), isofile_path ) ), HWeight(1, Empty()) ) ) ) ), Left( RadioButton( Id(:directory), Opt(:notify), # radio button label _("Create Directory &Tree Only"), result == "tree" ) ) ) ) ) ), VSpacing(1), # frame label Frame( _("Other Options"), VBox( Left( CheckBox( Id(:savespace), # check box label _("Copy only needed files to save space."), savespace ) ), VSpacing(), Left( InputField( Id(:pub), Opt(:hstretch), # text entry label _("CD Publisher:"), publisher ) ), Left( InputField( Id(:prep), Opt(:hstretch), # text entry label _("CD Preparer:"), preparer ) ) ) ) ) ) Wizard.SetContentsButtons( caption, contents, Ops.get_string(@HELPS, "dest", ""), Label.BackButton, Label.NextButton ) ret = nil while true rb = Convert.to_symbol(UI.QueryWidget(Id(:result), :CurrentButton)) if rb == :isofile UI.ChangeWidget(Id(:isofile_path), :Enabled, true) else UI.ChangeWidget(Id(:isofile_path), :Enabled, false) end ret = UI.UserInput # abort? if ret == :abort || ret == :cancel if ProductCreator.ReallyAbort break else next end elsif ret == :open_dir new_dir = UI.AskForExistingDirectory( dirtree, # ask for directory widget label _("Select Directory") ) if new_dir != nil UI.ChangeWidget(Id(:dirtree), :Value, Convert.to_string(new_dir)) end next elsif ret == :back @going_back = true break elsif ret == :next isodir = Convert.to_string(UI.QueryWidget(Id(:dirtree), :Value)) if isodir == "" # error popup Report.Error(_("Path to generated directory tree missing.")) next else Ops.set(ProductCreator.Config, "iso-directory", isodir) end if rb == :isofile Ops.set(ProductCreator.Config, "result", "iso") Ops.set( ProductCreator.Config, "isofile", Convert.to_string(UI.QueryWidget(Id(:isofile_path), :Value)) ) else Ops.set(ProductCreator.Config, "result", "tree") end Ops.set( ProductCreator.Config, "savespace", Convert.to_boolean(UI.QueryWidget(Id(:savespace), :Value)) ) Ops.set( ProductCreator.Config, "publisher", Convert.to_string(UI.QueryWidget(Id(:pub), :Value)) ) Ops.set( ProductCreator.Config, "preparer", Convert.to_string(UI.QueryWidget(Id(:prep), :Value)) ) break elsif ret != :directory && ret != :isofile Builtins.y2error("unexpected retcode: %1", ret) next end end Convert.to_symbol(ret) end |
- (Object) createTableItem(source, selectable, media_filter)
Create a table item from a map as returned by the InstSrcManager agent. @param [Fixnum] source The map describing the source as returned form the agent. @return An item suitable for addition to a Table.
62 63 64 65 66 67 68 69 70 71 72 73 74 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 |
# File '../../src/include/product-creator/dialogs.rb', line 62 def createTableItem(source, selectable, media_filter) # Source data sd = SourceManager.SourceData(source) Builtins.y2milestone("SourceManager:: sources: %1", sd) item = Item() url = URL.Parse(Ops.get_string(sd, "url", "")) if media_filter == "" || Ops.get_string(url, "scheme", "") == media_filter if selectable item = Item( Id(source), "", Ops.get_boolean( # corresponds to the "Enable/Disable" button sd, "enabled", true ) ? _("On") : _("Off"), Ops.get_string(sd, "alias", ""), Ops.get_string(sd, "url", "") ) else item = Item( Id(source), Ops.get_boolean( # corresponds to the "Enable/Disable" button sd, "enabled", true ) ? _("On") : _("Off"), Ops.get_string(sd, "alias", ""), Ops.get_string(sd, "url", "") ) end end Builtins.y2debug("Table item for source %1: %2", source, item) deep_copy(item) end |
- (Object) detailedSelection(mode)
Start the detailed package selection. If 'mode' is non-nil, it will be passed as an option to the PackageSelector widget.
Returns accept or
cancel .
1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 |
# File '../../src/include/product-creator/dialogs.rb', line 1398 def detailedSelection(mode) # Open empty dialog for instant feedback UI.OpenDialog( Opt(:defaultsize), ReplacePoint(Id(:rep), Label(_("Reading package database..."))) ) # This will take a while: Detailed package data are retrieved # while the package manager is initialized UI.ReplaceWidget( :rep, mode == nil ? PackageSelector(Id(:packages)) : PackageSelector(Id(:packages), Opt(mode)) ) result = Convert.to_symbol(UI.RunPkgSelection(Id(:packages))) UI.CloseDialog Builtins.y2milestone("Package selector returned %1", result) result end |
- (Array) fillSourceTable(sources, selectable, media_filter)
Fill sources table with entries from the InstSrcManager agent.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File '../../src/include/product-creator/dialogs.rb', line 108 def fillSourceTable(sources, selectable, media_filter) sources = deep_copy(sources) sources = Pkg.SourceGetCurrent(false) if Builtins.size(sources) == 0 items = [] items = Builtins.maplist(sources) do |source| Builtins.y2debug("working on source: %1", source) createTableItem(source, selectable, media_filter) end items = Builtins.filter(items) { |i| Ops.get_string(i, 3, "") != "" } deep_copy(items) end |
- (Object) GpgDialogContent
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 |
# File '../../src/include/product-creator/dialogs.rb', line 1766 def GpgDialogContent MarginBox( 2, 1, VBox( Left("sign_checkbox"), VSpacing(0.5), "select_private_key", VSpacing(1), "create_new_key" ) ) end |
- (Object) gpgKeyDialog
1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 |
# File '../../src/include/product-creator/dialogs.rb', line 1845 def gpgKeyDialog caption = _("Signing the Product on the Medium") if Ops.get_string(ProductCreator.Config, "gpg_key", "") != "" # preselect the key GPGWidgets.SetSelectedPrivateKey( Ops.get_string(ProductCreator.Config, "gpg_key", "") ) end ret = nil begin ret = CWM.ShowAndRun( { "widget_names" => [ "sign_checkbox", "select_private_key", "create_new_key" ], "widget_descr" => Builtins.union( GPGWidgets.Widgets, ), "contents" => GpgDialogContent(), "caption" => caption, "back_button" => Label.BackButton, "next_button" => Label.NextButton, "fallback_functions" => {} } ) end while ret == :abort && !ProductCreator.ReallyAbort sign = Convert.to_boolean(UI.QueryWidget(Id("sign_checkbox"), :Value)) Builtins.y2milestone("Sign the medium: %1", sign) gpg_key = sign ? GPGWidgets.SelectedPrivateKey : "" Builtins.y2milestone("GPG signing key: %1", gpg_key) # remember the key Ops.set(ProductCreator.Config, "gpg_key", gpg_key) ret end |
- (Object) initialize_product_creator_dialogs(include_target)
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File '../../src/include/product-creator/dialogs.rb', line 30 def initialize_product_creator_dialogs(include_target) Yast.import "UI" Yast.import "Pkg" textdomain "product-creator" Yast.import "FileUtils" Yast.import "ProductCreator" Yast.import "Wizard" Yast.import "SourceManager" Yast.import "Report" Yast.import "URL" Yast.import "Label" Yast.import "Popup" Yast.import "GPG" Yast.import "GPGWidgets" Yast.import "CWM" Yast.import "String" Yast.import "Package" Yast.import "Arch" Yast.import "PackagesUI" Yast.include include_target, "product-creator/routines.rb" Yast.include include_target, "product-creator/helps.rb" # remember the direction to correctly skip baseProductSelectionDialog() @going_back = false end |
- (Object) InstallPackageOrProvider(p)
159 160 161 |
# File '../../src/include/product-creator/dialogs.rb', line 159 def InstallPackageOrProvider(p) InstallPackageOrProviderVersion(p, "") end |
- (Object) InstallPackageOrProviderVersion(p, version)
Select package for installation. If package itself is not available, find package providing it If version is not empty, select specific package version
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File '../../src/include/product-creator/dialogs.rb', line 125 def InstallPackageOrProviderVersion(p, version) selected = version == "" ? Pkg.PkgInstall(p) : Pkg.ResolvableInstallArchVersion( p, :package, ProductCreator.GetArch, version ) Builtins.y2milestone( "selecting package for installation: %1 -> %2", p, selected ) if !selected provides = Pkg.PkgQueryProvides(p) provides = Builtins.filter(provides) do |l| Ops.get_symbol(l, 1, :NONE) != :NONE end pp = Ops.get_string(provides, [0, 0], "") if pp != "" Builtins.y2milestone( "selecting first package providing %1: %2 -> %3", p, pp, Pkg.PkgInstall(pp) ) end end true end |
- (Object) isolinuxDialog
Configure3 dialog
1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 |
# File '../../src/include/product-creator/dialogs.rb', line 1221 def isolinuxDialog # dialog caption caption = _("Product Creator Configuration") isolinux = ProductCreator.Readisolinux # FIXME: Manage files for other archs bootconfig = "isolinux.cfg" contents = VBox( MultiLineEdit( Id(:isolinux), Builtins.sformat(_("File Contents: %1"), bootconfig), isolinux ), PushButton(Id(:loadfile), _("Load File")) ) Wizard.SetContentsButtons( caption, contents, Ops.get_string(@HELPS, "bootconfig", ""), Label.BackButton, Label.NextButton ) ret = nil while true ret = UI.UserInput # abort? if ret == :abort || ret == :cancel if ProductCreator.ReallyAbort break else next end elsif ret == :loadfile new_file = UI.AskForExistingFile("", "*", _("Select File")) if new_file != nil if Ops.greater_than(SCR.Read(path(".target.size"), new_file), 0) file = Convert.to_string( SCR.Read(path(".target.string"), new_file) ) UI.ChangeWidget(Id(:isolinux), :Value, file) end end next elsif ret == :next isolinux_new = Convert.to_string( UI.QueryWidget(Id(:isolinux), :Value) ) Ops.set(ProductCreator.Config, "bootconfig", isolinux_new) Builtins.y2milestone("Isolinux config: %1", isolinux_new) break elsif ret == :back break else Builtins.y2error("unexpected retcode: %1", ret) next end end if Ops.get_string(ProductCreator.Config, "profile", "") != "" && ret == :next return :autoyast end Convert.to_symbol(ret) end |
- (Symbol) packageSelector
Select packages
1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 |
# File '../../src/include/product-creator/dialogs.rb', line 1706 def packageSelector result = {} begin base_pattern = Ops.get_string(ProductCreator.Config, "base", "") patterns = Ops.get_list(ProductCreator.Config, "addons", []) packages = Ops.get_list(ProductCreator.Config, "packages", []) taboo = Ops.get_list(ProductCreator.Config, "taboo", []) versions = Builtins.listmap( Ops.get_list(ProductCreator.Config, "package_versions", []) ) do |p| { Ops.get_string(p, "name", "") => Ops.get_string(p, "version", "") } end result = runPackageSelectorVersions( base_pattern, patterns, packages, versions, taboo, :patterns ) Builtins.y2debug("Package selector result: %1", result) Ops.set( ProductCreator.Config, "base", Ops.get_string(result, "base", "") ) Ops.set( ProductCreator.Config, "addons", Ops.get_list(result, "addons", []) ) Ops.set( ProductCreator.Config, "packages", Ops.get_list(result, "packages", []) ) Ops.set( ProductCreator.Config, "taboo", Ops.get_list(result, "taboo", []) ) Ops.set( ProductCreator.Config, "type", Ops.get_symbol(result, "type", :patterns) ) end while Ops.get_symbol(result, "ui", :next) == :cancel && !ProductCreator.ReallyAbort # the package selector returns `cancel when pressing [Abort] return :abort if Ops.get_symbol(result, "ui", :next) == :cancel Ops.get_symbol(result, "ui", :next) end |
- (Object) patternSelection
Start the pattern selection dialog. If the UI does not support the PatternSelector, start the detailed selection with “selections” as the initial view.
1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 |
# File '../../src/include/product-creator/dialogs.rb', line 1426 def patternSelection if !UI.HasSpecialWidget(:PatternSelector) || UI.WizardCommand(term(:Ping)) != true return detailedSelection(nil) # Fallback: detailed selection end # switch to packager textdomain, reuse the translations # Help text for software patterns / selections dialog helptext = _( "<p>\n" + "Select one of the following <b>base</b> selections and click <i>Detailed<i> to add\n" + "more <b>add-on</b> selections and packages.\n" + "</p>" ) Wizard.SetContents( # dialog caption _("Software Selection"), PatternSelector(Id(:patterns)), helptext, true, # has_back true ) # has_next Wizard.SetDesktopIcon("sw_single") result = nil begin result = Convert.to_symbol(UI.RunPkgSelection(Id(:patterns))) Builtins.y2milestone("Pattern selector returned %1", result) if result == :details result = detailedSelection(nil) if result == :cancel # don't get all the way out - the user might just have # been scared of the gory details. result = nil end end end until result == :cancel || result == :accept result = :next if result == :accept result end |
- (Object) ProductFromRepo(repo_id)
1093 1094 1095 1096 1097 1098 1099 |
# File '../../src/include/product-creator/dialogs.rb', line 1093 def ProductFromRepo(repo_id) read_content = ProductCreator.ReadContentFile(repo_id) prod_name = Ops.get(read_content, "LABEL", "") Builtins.y2milestone("Product name: %1", prod_name) prod_name end |
- (Object) ProductFromURL(url)
1101 1102 1103 1104 1105 1106 1107 |
# File '../../src/include/product-creator/dialogs.rb', line 1101 def ProductFromURL(url) src_id = Ops.get(ProductCreator.UrlToId([url]), 0, -1) Builtins.y2milestone("Reading product name from src %1", src_id) prod_name = ProductFromRepo(src_id) prod_name end |
- (Object) refreshSigningDialog(sign)
1780 1781 1782 1783 1784 1785 1786 |
# File '../../src/include/product-creator/dialogs.rb', line 1780 def refreshSigningDialog(sign) UI.ChangeWidget(Id("create_new_key"), :Enabled, sign) UI.ChangeWidget(Id(:gpg_priv_table), :Enabled, sign) UI.ChangeWidget(Id(:gpg_priv_label), :Enabled, sign) nil end |
- (Hash{String => Object}) runPackageSelector(base_pattern, patterns, packages, taboo, mode)
Display package selection dialog with preselected packages.
1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 |
# File '../../src/include/product-creator/dialogs.rb', line 1690 def runPackageSelector(base_pattern, patterns, packages, taboo, mode) patterns = deep_copy(patterns) packages = deep_copy(packages) taboo = deep_copy(taboo) runPackageSelectorVersions( base_pattern, patterns, packages, {}, taboo, mode ) end |
- (Object) runPackageSelectorVersions(base_pattern, patterns, packages, versions, taboo, mode)
Display package selection dialog with preselected packages. See runPackageSelector
1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 |
# File '../../src/include/product-creator/dialogs.rb', line 1477 def runPackageSelectorVersions(base_pattern, patterns, packages, versions, taboo, mode) patterns = deep_copy(patterns) packages = deep_copy(packages) versions = deep_copy(versions) taboo = deep_copy(taboo) Builtins.y2milestone( "running package selector: base_pattern: %1, patterns: %2, packages: %3, versions: %4 taboo: %5, mode: %6", base_pattern, patterns, packages, versions, taboo, mode ) ret = nil Pkg.ResolvableNeutral("", :package, true) Pkg.ResolvableNeutral("", :pattern, true) # set a mount point - there is no use to display DU of the current system Pkg.TargetInitDU( [ { "name" => "/", "free" => Ops.multiply(ProductCreator.max_size_mb, 1024), "used" => 0, "readonly" => false } ] ) # dialog caption caption = _("Software Selection") helptext = _( "<p>\n" + "Select one of the following <b>base</b> selections and click <i>Detailed<i> to add\n" + "more <b>add-on</b> selections and packages.\n" + "</p>" ) Pkg.TargetFinish Popup.ShowFeedback( _("Reading data from Package Database..."), _("Please wait...") ) ProductCreator.enableSources Popup.ClearFeedback Wizard.CreateDialog Wizard.SetDesktopTitleAndIcon("product-creator") base_selection = "" Wizard.SetContents( caption, HVCenter(Label(_("Reading package database..."))), helptext, false, true ) addons = deep_copy(patterns) # ensure that a langugage is selected ProductCreator.CheckLanguage if Ops.greater_than(Builtins.size(addons), 0) || Ops.get_string(ProductCreator.Config, "base", "") != "" Builtins.y2milestone( "base pattern: %1, addons: %2", base_pattern, addons ) # select the base pattern Pkg.ResolvableInstall(base_pattern, :pattern) if base_pattern != "" # select the addons Builtins.foreach(addons) do |addon| Pkg.ResolvableInstall(addon, :pattern) end # mark taboo packages ProductCreator.MarkTaboo(taboo) Pkg.PkgSolve(true) end # add extra packages Builtins.foreach(packages) do |p| InstallPackageOrProviderVersion(p, Ops.get(versions, p, "")) end if Ops.greater_than( Builtins.size(packages), 0 ) Builtins.y2milestone("package selection mode: %1", mode) if mode == :packages ret = detailedSelection(nil) elsif mode == :patterns ret = patternSelection else Builtins.y2error("Unknown mode parameter: %1", mode) end Builtins.y2milestone( "Selected packages: %1 ", Builtins.size(Pkg.GetPackages(:selected, true)) ) # activate the selections solved = ret == :cancel || Pkg.PkgSolve(true) if !solved details = Convert.to_string( SCR.Read(path(".target.string"), "/var/log/YaST2/badlist") ) # error message, %1 = details Report.LongError( Builtins.sformat( _("Dependencies cannot be resolved.\n\n%1\n"), details ) ) Wizard.CloseDialog return { "ui" => :failed } end allpacs = Pkg.GetPackages(:selected, true) Builtins.y2milestone( "All packages: %1 ( %2 )", allpacs, Builtins.size(allpacs) ) seladd = [] selbase = [] if ret != :back && ret != :cancel # do not return patterns selected by dependencies Builtins.foreach(Pkg.ResolvableProperties("", :pattern, "")) do |pat| Builtins.y2debug("Processing pattern: %1", pat) if Ops.get_symbol(pat, "status", :none) == :selected pat_name = Ops.get_string(pat, "name", "") Builtins.y2milestone( "pat %1 selected by %2", pat_name, Ops.get(pat, "transact_by") ) if Ops.get(pat, "transact_by") != :solver seladd = Builtins.add(seladd, pat_name) end if Ops.get_string(pat, "category", "") == "base" selbase = Builtins.add(selbase, pat_name) end end end else seladd = deep_copy(patterns) selbase = [base_pattern] end ret_map = {} Ops.set(ret_map, "packages", Pkg.FilterPackages(false, true, true, true)) Builtins.y2milestone( "User selected packages: %1", Ops.get_list(ret_map, "packages", []) ) Ops.set(ret_map, "base", Ops.get_string(selbase, 0, "")) Builtins.y2milestone("selected base: %1", Ops.get_string(selbase, 0, "")) if Ops.greater_than(Builtins.size(selbase), 1) # add the other base patterns to addons other_base = Builtins.remove(selbase, 0) seladd = Builtins.merge(other_base, seladd) end Ops.set(ret_map, "addons", seladd) Builtins.y2milestone("selected addons: %1", seladd) # remember taboo packages Ops.set(ret_map, "taboo", Pkg.GetPackages(:taboo, true)) Builtins.y2milestone( "taboo packages: %1", Ops.get_list(ret_map, "taboo", []) ) # patterns are used in the product Ops.set(ret_map, "type", :patterns) Ops.set(ret_map, "ui", ret) Wizard.CloseDialog deep_copy(ret_map) end |
- (Object) sign_checkbox_widget
1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 |
# File '../../src/include/product-creator/dialogs.rb', line 1816 def { "sign_checkbox" => { "widget" => :checkbox, "opt" => [:notify], "init" => fun_ref(method(:signCheckboxInit), "void (string)"), "label" => _("&Digitally Sign the Product on the Medium"), "handle_events" => ["sign_checkbox"], "handle" => fun_ref( method(:SignContent), "symbol (string, map)" ), # TODO: validate the dialog (is a key selected if the checkbox is selected? # "validate_help" : _("Select a gpg key in the table. Create...") "help" => _( "<p><big><b>Sign</b></big><br>\n" + "To make it possible for users to verify your product, sign it with a GPG key. \n" + "This key is checked when the product is added as a repository.</p>" ) + # part of the help text (signing dialog), the URL can be modified to the translated language # (if the page exists in that language, you have to check that!) _( "<P>If the product is not signed, Yast automatically adds the option 'Insecure:\n1' to the linuxrc configuration file, otherwise linuxrc would deny loading an unsigned installation system at boot. See http://en.opensuse.org/Linuxrc for more information.</P>" ) } } end |
- (Object) signCheckboxInit(key)
1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 |
# File '../../src/include/product-creator/dialogs.rb', line 1801 def signCheckboxInit(key) if key == "sign_checkbox" sign = false if Ops.get_string(ProductCreator.Config, "gpg_key", "") != "" sign = true end UI.ChangeWidget(Id("sign_checkbox"), :Value, sign) refreshSigningDialog(sign) end nil end |
- (Object) SignContent(key, event)
1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 |
# File '../../src/include/product-creator/dialogs.rb', line 1788 def SignContent(key, event) event = deep_copy(event) Builtins.y2debug("SignContent: %1, %2", key, event) if key == "sign_checkbox" # refresh table and pushbutton state sign = Convert.to_boolean(UI.QueryWidget(Id("sign_checkbox"), :Value)) refreshSigningDialog(sign) end nil end |
- (Symbol) sourceDialog
Dialog for selecting the sources
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 |
# File '../../src/include/product-creator/dialogs.rb', line 800 def sourceDialog # dialog caption caption = _("Source Selection") SourceManager.ReadSources sources = fillSourceTable([], true, "") Builtins.y2debug("sources: %1", sources) table = Table( Id(:table), Opt(:keepSorting, :notify), Header(_("Selected"), _("Status"), _("Name"), _("URL")), sources ) = VBox( HBox( ReplacePoint( Id(:rp), Label( Builtins.sformat( _("Target architecture: %1"), ProductCreator.GetArch ) ) ), HSpacing(2), PushButton(Id(:arch), Label.EditButton) ), VSpacing(0.3), HBox( PushButton(Id(:select), Label.SelectButton), PushButton(Id(:remove), Label.RemoveButton), # push button label PushButton(Id(:create), _("Cr&eate New...")) ) ) contents = VBox(table, VSpacing(0.5), ) Wizard.SetContentsButtons( caption, contents, Ops.get_string(@HELPS, "sourceDialog", ""), Label.BackButton, Label.NextButton ) selected_items = ProductCreator.UrlToId( Ops.get_list(ProductCreator.Config, "sources", []) ) # remove not found sources (with id = -1) selected_items = Builtins.filter(selected_items) do |source_id| Ops.greater_or_equal(source_id, 0) end Builtins.foreach(selected_items) do |i| UI.ChangeWidget(Id(:table), term(:Item, i, 0), _("X")) end # report unavailbale sources if any ProductCreator.CheckUnavailableSources ret = nil while true ret = UI.UserInput if ret == :table _ID = Convert.to_integer(UI.QueryWidget(Id(:table), :CurrentItem)) ret = Builtins.contains(selected_items, _ID) ? :remove : :select end # abort? if ret == :abort || ret == :cancel if ProductCreator.ReallyAbort break else next end elsif ret == :select _SrcID = Convert.to_integer(UI.QueryWidget(Id(:table), :CurrentItem)) repo_ok = CheckArchitecture(_SrcID) if repo_ok if !Builtins.contains(selected_items, _SrcID) selected_items = Builtins.add(selected_items, _SrcID) general_info = Pkg.SourceGeneralData(_SrcID) # enable the source if Ops.get_boolean(general_info, "enabled", false) Pkg.SourceSetEnabled(_SrcID, true) end end UI.ChangeWidget(Id(:table), term(:Item, _SrcID, 0), _("X")) # refresh the target architecture if it has been changed if ProductCreator.GetPackageArch != nil UI.ReplaceWidget( :rp, Label( Builtins.sformat( _("Target Architecture: %1"), ProductCreator.GetPackageArch ) ) ) end end elsif ret == :remove _SrcID = Convert.to_integer(UI.QueryWidget(Id(:table), :CurrentItem)) general_info = Pkg.SourceGeneralData(_SrcID) # disable the source if Ops.get_boolean(general_info, "enabled", false) Pkg.SourceSetEnabled(_SrcID, false) end selected_items = Builtins.filter(selected_items) { |i| _SrcID != i } UI.ChangeWidget(Id(:table), term(:Item, _SrcID, 0), "") elsif ret == :create if Package.Install("yast2-add-on-creator") createret = Convert.to_symbol( WFM.CallFunction("add-on-creator", []) ) if createret == :next ex = Convert.to_map( WFM.CallFunction("add-on-creator_auto", ["Export"]) ) product_path = Ops.get_string(ex, "product_path", "") if product_path != "" url = Ops.get_boolean(ex, "iso", false) ? "file://" : "dir://" if Pkg.SourceCreate(Ops.add(url, product_path), "") != -1 SourceManager.ReadSources sources2 = fillSourceTable([], true, "") UI.ChangeWidget(Id(:table), :Items, sources2) Builtins.foreach(sources2) do |source| _SrcID = Ops.get_integer(source, [0, 0], -1) if _SrcID != -1 && Builtins.contains(selected_items, _SrcID) UI.ChangeWidget( Id(:table), term(:Item, _SrcID, 0), _("X") ) end end Pkg.SourceSaveAll end end end end elsif ret == :next Builtins.y2milestone("selected items: %1", selected_items) Ops.set( ProductCreator.Config, "sources", ProductCreator.getSourceURLs(selected_items) ) Builtins.y2milestone( "sources: %1", Ops.get_list(ProductCreator.Config, "sources", []) ) if Builtins.size(Ops.get_list(ProductCreator.Config, "sources", [])) == 0 Report.Error(_("Select at least one source.")) next end arch = ProductCreator.GetPackageArch if arch != nil Builtins.y2milestone( "Target architecture has been changed to %1", arch ) Ops.set(ProductCreator.Config, "arch", arch) check_ok = true arch_changed = false begin ar = ProductCreator.GetPackageArch check_ok = true arch_changed = false # all selected sources should be refreshed # check archs onece again (needed after switching architecture multiple times) Builtins.foreach(selected_items) do |src| if !CheckArchitecture(src) check_ok = false raise Break end arch_changed = arch_changed || ar != ProductCreator.GetPackageArch end end while arch_changed if !check_ok # error message Report.Error( _( "There is a mismatch between the selected\n" + "repositories and the machine architecture.\n" + "\n" + "Either select a different repository or\n" + "change the target architecture.\n" ) ) # don't leave the dialog next end # temporarily initialize the target, read trusted GPG keys (needed for refresh) Pkg.TargetInit("/", false) Builtins.foreach(selected_items) do |src| Pkg.SourceForceRefreshNow(src) end # reload repositories Pkg.SourceFinishAll Pkg.SourceStartManager(false) # finish the target Pkg.TargetFinish end @going_back = false break elsif ret == :back break elsif ret == :arch # ask for the target architecture pkg_arch = ProductCreator.GetPackageArch pkg_arch = Pkg.SystemArchitecture if pkg_arch == nil new_arch = AskArch( _("Select the new target architecture."), # sort the list according to the current locale Builtins.lsort( [ "i386", "i486", "i586", "i686", "sparc", "sparc64", "mips", "mips64", "ppc", "ppc64", "alpha", "s390", "s390x", "ia64", "x86_64" ] ), pkg_arch ) # nil == switch has been canceled if new_arch != nil && new_arch != "" && new_arch != pkg_arch # change the architecture ProductCreator.SetPackageArch(new_arch) UI.ReplaceWidget( :rp, Label( Builtins.sformat( _("Target Architecture: %1"), ProductCreator.GetPackageArch ) ) ) end else Builtins.y2error("unexpected retcode: %1", ret) next end end Convert.to_symbol(ret) end |