36 except ImportError: |
36 except ImportError: |
37 sys.exit(1) |
37 sys.exit(1) |
38 import pkg.gui.misc as gui_misc |
38 import pkg.gui.misc as gui_misc |
39 import pkg.gui.parseqs as parseqs |
39 import pkg.gui.parseqs as parseqs |
40 from pkg.client import global_settings |
40 from pkg.client import global_settings |
|
41 import pkg.gui.enumerations as enumerations |
|
42 import pkg.gui.repository as repository |
41 |
43 |
42 logger = global_settings.logger |
44 logger = global_settings.logger |
43 |
45 |
44 ( |
46 ( |
45 DISPLAY_LINK, |
47 DISPLAY_LINK, |
69 #Internal field: go to search all publishers page |
71 #Internal field: go to search all publishers page |
70 INTERNAL_SEARCH_ALL_PUBS = "search_all_publishers" #Internal field: search all publishers |
72 INTERNAL_SEARCH_ALL_PUBS = "search_all_publishers" #Internal field: search all publishers |
71 INTERNAL_SEARCH_ALL_PUBS_INSTALLED = "search_all_publishers_installed" |
73 INTERNAL_SEARCH_ALL_PUBS_INSTALLED = "search_all_publishers_installed" |
72 #Internal field: search all publishers installed |
74 #Internal field: search all publishers installed |
73 INTERNAL_SEARCH_HELP = "search_help" # Internal field: display search help |
75 INTERNAL_SEARCH_HELP = "search_help" # Internal field: display search help |
|
76 |
|
77 INTERNAL_SEARCH_MNG_PUBS = "search_mng_pubs" |
|
78 # Internal field: display Manage Publishers dialog |
74 |
79 |
75 FONTSIZE_H3_DEFAULT = 16 # Default H3 font size when display web page |
80 FONTSIZE_H3_DEFAULT = 16 # Default H3 font size when display web page |
76 FONTSIZE_BODY_DEFAULT = 10 # Default Body font size when display web page |
81 FONTSIZE_BODY_DEFAULT = 10 # Default Body font size when display web page |
77 |
82 |
78 # External Example: <a href="pm?pm-action=external&uri=www.opensolaris.com"> |
83 # External Example: <a href="pm?pm-action=external&uri=www.opensolaris.com"> |
344 _("Loading %(s1)sSearch Help%(e1)s ...") % |
349 _("Loading %(s1)sSearch Help%(e1)s ...") % |
345 {"s1": s1, "e1": e1}) |
350 {"s1": s1, "e1": e1}) |
346 gui_misc.display_help("search-pkg") |
351 gui_misc.display_help("search-pkg") |
347 return |
352 return |
348 |
353 |
|
354 if search_action and search_action == INTERNAL_SEARCH_MNG_PUBS: |
|
355 if handle_what == DISPLAY_LINK: |
|
356 return _("Display %(s1)sManage Publishers%(e1)s") % \ |
|
357 {"s1": s1, "e1": e1} |
|
358 self.parent.update_statusbar_message( |
|
359 _("Loading %(s1)sManage Publishers%(e1)s ...") % |
|
360 {"s1": s1, "e1": e1}) |
|
361 |
|
362 repository.Repository(self.parent, |
|
363 self.parent.image_directory, |
|
364 action=enumerations.MANAGE_PUBLISHERS, |
|
365 main_window = self.parent.w_main_window, |
|
366 gconf = self.parent.gconf) |
|
367 return |
|
368 |
349 # View Recent Search Results |
369 # View Recent Search Results |
350 if search_action and \ |
370 if search_action and \ |
351 search_action.find(INTERNAL_SEARCH_VIEW_RESULTS) > -1: |
371 search_action.find(INTERNAL_SEARCH_VIEW_RESULTS) > -1: |
352 recent_search = \ |
372 recent_search = \ |
353 re.findall(r'<span>(.*)<\/span>', search_action)[0] |
373 re.findall(r'<span>(.*)<\/span>', search_action)[0] |
477 "/" + self.image_prefix + "dialog-warning.png", |
497 "/" + self.image_prefix + "dialog-warning.png", |
478 self.cached_internal_stream) |
498 self.cached_internal_stream) |
479 |
499 |
480 self.__load_internal_page(self.cached_internal_stream) |
500 self.__load_internal_page(self.cached_internal_stream) |
481 |
501 |
|
502 def setup_search_all_no_pubs_page(self): |
|
503 tbl_header = INFORMATION_TABLE_HEADER % {"base": START_PAGE_IMAGES_BASE, |
|
504 "prefix": self.image_prefix} |
|
505 tbl_header += _("alt='[Information]' title='Information' ALIGN='bottom'>" |
|
506 "</TD><TD><h3><b>Search All Publishers</b></h3><TD></TD>" |
|
507 "</TR><TR><TD></TD><TD> There is nothing to search as there are no " |
|
508 "configured or enabled publishers.</TD></TR>" |
|
509 ) |
|
510 |
|
511 tbl_body = _("<TR><TD></TD><TD<TD></TD></TR><TR><TD></TD><TD<TD></TD>" |
|
512 "</TR><TR><TD></TD><TD<TD><b>Suggestions:</b><br></TD></TR>" |
|
513 "<TR><TD></TD><TD<TD>" |
|
514 ) |
|
515 |
|
516 tbl_body += _("<li style='padding-left:7px'>" |
|
517 "Add or enable publishers: <a href='pm?pm-action=internal&search=" |
|
518 "%s'>Manage Publishers</a></li></TD></TR>") % INTERNAL_SEARCH_MNG_PUBS |
|
519 tbl_footer = "</table>" |
|
520 self.__load_internal_page(tbl_header + tbl_body + tbl_footer) |
|
521 |
|
522 |
482 def setup_search_all_page(self, publisher_list, publisher_all): |
523 def setup_search_all_page(self, publisher_list, publisher_all): |
|
524 if not publisher_list: |
|
525 self.setup_search_all_no_pubs_page() |
|
526 return |
483 tbl_header = INFORMATION_TABLE_HEADER % {"base": START_PAGE_IMAGES_BASE, |
527 tbl_header = INFORMATION_TABLE_HEADER % {"base": START_PAGE_IMAGES_BASE, |
484 "prefix": self.image_prefix} |
528 "prefix": self.image_prefix} |
485 tbl_header += _("alt='[Information]' title='Information' ALIGN='bottom'>" |
529 tbl_header += _("alt='[Information]' title='Information' ALIGN='bottom'>" |
486 "</TD><TD><h3><b>Search All Publishers</b></h3><TD></TD></TR>" |
530 "</TD><TD><h3><b>Search All Publishers</b></h3><TD></TD></TR>" |
487 "<TR><TD></TD><TD> Use the Search field to search for packages " |
531 "<TR><TD></TD><TD> Use the Search field to search for packages " |