Beginning Python - From Novice to Professional
Beginning Python - From Novice to Professional Beginning Python - From Novice to Professional
CHAPTER 28 ■ PROJECT 9: FILE SHARING II—NOW WITH GUI! 525 except Fault, f: if f.faultCode != UNHANDLED: raise print "Couldn't find the file", query def main(): urlfile, directory, url = sys.argv[1:] client = Client(url, directory, urlfile) client.MainLoop() if __name__ == '__main__': main() Further Exploration Some ideas for extending the file sharing system are given in Chapter 27. Here are some more: • Add a status bar that displays such messages as “Downloading” or “Couldn’t find file foo.txt.” • Figure out ways for Nodes to share their “friends.” For example, when one Node is introduced to another, each of them could introduce the other to the Nodes it already knows. Also, before a Node shuts down, it might tell all its current neighbors of all the Nodes it knows. • Add a list of known Nodes (URLs) to the GUI. Make it possible to add new URLs and save them in a URL file. What Now? Now you’ve written a full-fledged GUI-enabled peer-to-peer file sharing system. Although that sounds pretty challenging, it wasn’t all that hard, was it? Now it’s time to face the last and greatest challenge: writing your own arcade game.
- Page 506 and 507: CHAPTER 25 ■ PROJECT 6: REMOTE ED
- Page 508 and 509: CHAPTER 25 ■ PROJECT 6: REMOTE ED
- Page 510 and 511: CHAPTER 25 ■ PROJECT 6: REMOTE ED
- Page 512: CHAPTER 25 ■ PROJECT 6: REMOTE ED
- Page 515 and 516: 484 CHAPTER 26 ■ PROJECT 7: YOUR
- Page 517 and 518: 486 CHAPTER 26 ■ PROJECT 7: YOUR
- Page 519 and 520: 488 CHAPTER 26 ■ PROJECT 7: YOUR
- Page 521 and 522: 490 CHAPTER 26 ■ PROJECT 7: YOUR
- Page 523 and 524: 492 CHAPTER 26 ■ PROJECT 7: YOUR
- Page 525 and 526: 494 CHAPTER 26 ■ PROJECT 7: YOUR
- Page 527 and 528: 496 CHAPTER 26 ■ PROJECT 7: YOUR
- Page 529 and 530: 498 CHAPTER 26 ■ PROJECT 7: YOUR
- Page 531 and 532: 500 CHAPTER 27 ■ PROJECT 8: FILE
- Page 533 and 534: 502 CHAPTER 27 ■ PROJECT 8: FILE
- Page 535 and 536: 504 CHAPTER 27 ■ PROJECT 8: FILE
- Page 537 and 538: 506 CHAPTER 27 ■ PROJECT 8: FILE
- Page 539 and 540: 508 CHAPTER 27 ■ PROJECT 8: FILE
- Page 541 and 542: 510 CHAPTER 27 ■ PROJECT 8: FILE
- Page 543 and 544: 512 CHAPTER 27 ■ PROJECT 8: FILE
- Page 545 and 546: 514 CHAPTER 27 ■ PROJECT 8: FILE
- Page 547 and 548: 516 CHAPTER 27 ■ PROJECT 8: FILE
- Page 549 and 550: 518 CHAPTER 28 ■ PROJECT 9: FILE
- Page 551 and 552: 520 CHAPTER 28 ■ PROJECT 9: FILE
- Page 553 and 554: 522 CHAPTER 28 ■ PROJECT 9: FILE
- Page 555: 524 CHAPTER 28 ■ PROJECT 9: FILE
- Page 559 and 560: 528 CHAPTER 29 ■ PROJECT 10: DO-I
- Page 561 and 562: 530 CHAPTER 29 ■ PROJECT 10: DO-I
- Page 563 and 564: 532 CHAPTER 29 ■ PROJECT 10: DO-I
- Page 565 and 566: 534 CHAPTER 29 ■ PROJECT 10: DO-I
- Page 567 and 568: 536 CHAPTER 29 ■ PROJECT 10: DO-I
- Page 569 and 570: 538 CHAPTER 29 ■ PROJECT 10: DO-I
- Page 571 and 572: 540 CHAPTER 29 ■ PROJECT 10: DO-I
- Page 573 and 574: 542 CHAPTER 29 ■ PROJECT 10: DO-I
- Page 575 and 576: 544 CHAPTER 29 ■ PROJECT 10: DO-I
- Page 577 and 578: 546 CHAPTER 29 ■ PROJECT 10: DO-I
- Page 579 and 580: 548 APPENDIX A ■ THE SHORT VERSIO
- Page 581 and 582: 550 APPENDIX A ■ THE SHORT VERSIO
- Page 583 and 584: 552 APPENDIX A ■ THE SHORT VERSIO
- Page 585 and 586: 554 APPENDIX A ■ THE SHORT VERSIO
- Page 588 and 589: APPENDIX B ■ ■ ■ Python Refer
- Page 590 and 591: APPENDIX B ■ PYTHON REFERENCE 559
- Page 592 and 593: APPENDIX B ■ PYTHON REFERENCE 561
- Page 594 and 595: APPENDIX B ■ PYTHON REFERENCE 563
- Page 596 and 597: APPENDIX B ■ PYTHON REFERENCE 565
- Page 598 and 599: APPENDIX B ■ PYTHON REFERENCE 567
- Page 600 and 601: APPENDIX B ■ PYTHON REFERENCE 569
- Page 602 and 603: APPENDIX C ■ ■ ■ Online Resou
- Page 604: APPENDIX C ■ ONLINE RESOURCES 573
CHAPTER 28 ■ PROJECT 9: FILE SHARING II—NOW WITH GUI! 525<br />
except Fault, f:<br />
if f.faultCode != UNHANDLED: raise<br />
print "Couldn't find the file", query<br />
def main():<br />
urlfile, direc<strong>to</strong>ry, url = sys.argv[1:]<br />
client = Client(url, direc<strong>to</strong>ry, urlfile)<br />
client.MainLoop()<br />
if __name__ == '__main__': main()<br />
Further Exploration<br />
Some ideas for extending the file sharing system are given in Chapter 27. Here are some more:<br />
• Add a status bar that displays such messages as “Downloading” or “Couldn’t find file<br />
foo.txt.”<br />
• Figure out ways for Nodes <strong>to</strong> share their “friends.” For example, when one Node is introduced<br />
<strong>to</strong> another, each of them could introduce the other <strong>to</strong> the Nodes it already knows.<br />
Also, before a Node shuts down, it might tell all its current neighbors of all the Nodes it knows.<br />
• Add a list of known Nodes (URLs) <strong>to</strong> the GUI. Make it possible <strong>to</strong> add new URLs and save<br />
them in a URL file.<br />
What Now?<br />
Now you’ve written a full-fledged GUI-enabled peer-<strong>to</strong>-peer file sharing system. Although that<br />
sounds pretty challenging, it wasn’t all that hard, was it? Now it’s time <strong>to</strong> face the last and<br />
greatest challenge: writing your own arcade game.