diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index 097939d640..68dc40b521 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -1429,7 +1429,17 @@ class Packager: else: self.multifile.addSubfile(file.newName, file.filename, compressionLevel) if file.extract: - xextract = self.getFileSpec('extract', file.filename, file.newName) + if file.text: + # Better write it to a temporary file, so we can + # get its hash. + tfile = Filename.temporary('', 'p3d_') + open(tfile.toOsSpecific(), 'wb').write(file.text) + xextract = self.getFileSpec('extract', tfile, file.newName) + tfile.unlink() + + else: + # The file data exists on disk already. + xextract = self.getFileSpec('extract', file.filename, file.newName) self.extracts.append((file.newName.lower(), xextract)) xcomponent = TiXmlElement('component') diff --git a/direct/src/p3d/panda3d.pdef b/direct/src/p3d/panda3d.pdef index 064c15dcce..7b91581531 100755 --- a/direct/src/p3d/panda3d.pdef +++ b/direct/src/p3d/panda3d.pdef @@ -1,4 +1,4 @@ -from pandac.PandaModules import getModelPath, Filename +from pandac.PandaModules import getModelPath, Filename, ConfigVariableFilename # This file defines a number of standard "packages" that correspond to # a Panda3D distribution. These packages are built by passing this @@ -63,8 +63,18 @@ class images(package): class p3dcert(package): # This special application, used to pop up a dialog to prompt the # user to accept or deny unknown applications, is its own package. + config(display_name = "Authorization Dialog") + file('p3dcert.exe') + # Also add the certificate authority file. + cvar = ConfigVariableFilename('ca-bundle-filename') + filename = Filename(cvar.getValue()) + if not filename.empty(): + print filename + file(filename, newName = 'ca-bundle.crt', extract = True) + + class panda3d(package): # The core Panda3D package. Contains Python and most of the graphics # code in Panda3D. diff --git a/direct/src/plugin/p3dCert.cxx b/direct/src/plugin/p3dCert.cxx index 991b58da90..77130b0cf1 100644 --- a/direct/src/plugin/p3dCert.cxx +++ b/direct/src/plugin/p3dCert.cxx @@ -73,22 +73,8 @@ no_cert_text = _T "Click Cancel to avoid running this application."); -// the event tables connect the wxWidgets events with the functions -// (event handlers) which process them. It can be also done at -// run-time, but for the simple menu events like this the static -// method is much simpler. -/* -BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(Minimal_Quit, MyFrame::OnQuit) - EVT_MENU(Minimal_About, MyFrame::OnAbout) -END_EVENT_TABLE() -*/ - -// Create a new application object: this macro will allow wxWidgets to -// create the application object during program execution (it's better -// than using a static object for many reasons) and also implements -// the accessor function wxGetApp() which will return the reference of -// the right type (i.e. P3DCertApp and not wxApp) +// wxWidgets boilerplate macro to define main() and start up the +// application. IMPLEMENT_APP(P3DCertApp) //////////////////////////////////////////////////////////////////// @@ -118,6 +104,7 @@ OnInit() { #endif AuthDialog *dialog = new AuthDialog(_cert_filename, _ca_filename); + SetTopWindow(dialog); dialog->Show(true); // Return true to enter the main loop and wait for user input. @@ -149,6 +136,15 @@ OnCmdLineParsed(wxCmdLineParser &parser) { return true; } + +// The event table for AuthDialog. +#define VIEW_CERT_BUTTON (wxID_HIGHEST + 1) +BEGIN_EVENT_TABLE(AuthDialog, wxDialog) + EVT_BUTTON(wxID_OK, AuthDialog::run_clicked) + EVT_BUTTON(VIEW_CERT_BUTTON, AuthDialog::view_cert_clicked) + EVT_BUTTON(wxID_CANCEL, AuthDialog::cancel_clicked) +END_EVENT_TABLE() + //////////////////////////////////////////////////////////////////// // Function: AuthDialog::Constructor // Access: Public @@ -185,6 +181,38 @@ AuthDialog:: } } +//////////////////////////////////////////////////////////////////// +// Function: AuthDialog::run_clicked +// Access: Public +// Description: The user clicks the "Run" button. +//////////////////////////////////////////////////////////////////// +void AuthDialog:: +run_clicked(wxCommandEvent &event) { + cerr << "run\n"; + Destroy(); +} + +//////////////////////////////////////////////////////////////////// +// Function: AuthDialog::run_clicked +// Access: Public +// Description: The user clicks the "View Certificate" button. +//////////////////////////////////////////////////////////////////// +void AuthDialog:: +view_cert_clicked(wxCommandEvent &event) { + cerr << "view cert\n"; +} + +//////////////////////////////////////////////////////////////////// +// Function: AuthDialog::run_clicked +// Access: Public +// Description: The user clicks the "Cancel" button. +//////////////////////////////////////////////////////////////////// +void AuthDialog:: +cancel_clicked(wxCommandEvent &event) { + cerr << "cancel\n"; + Destroy(); +} + //////////////////////////////////////////////////////////////////// // Function: AuthDialog::read_cert_file // Access: Private @@ -328,6 +356,7 @@ layout() { wxStaticText *text0 = new wxStaticText (panel, wxID_ANY, header, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER); + text0->SetFont(*bold_font); vsizer->Add(text0, 0, wxCENTER | wxALL, 10); } @@ -345,7 +374,7 @@ layout() { } if (_cert != NULL) { - wxButton *view_button = new wxButton(panel, wxID_ANY, _T("View Certificate")); + wxButton *view_button = new wxButton(panel, VIEW_CERT_BUTTON, _T("View Certificate")); bsizer->Add(view_button, 0, wxALIGN_CENTER | wxALL, 5); } @@ -381,7 +410,7 @@ get_text(wxString &header, wxString &text) { case X509_V_ERR_CERT_HAS_EXPIRED: case X509_V_ERR_CRL_NOT_YET_VALID: case X509_V_ERR_CRL_HAS_EXPIRED: - header = _T("Expired signatured!"); + header = _T("Expired signature!"); text.Printf(expired_cert_text, _common_name.c_str()); break; diff --git a/direct/src/plugin/p3dCert.h b/direct/src/plugin/p3dCert.h index 5366aa1c56..e2fbb161ef 100644 --- a/direct/src/plugin/p3dCert.h +++ b/direct/src/plugin/p3dCert.h @@ -56,12 +56,10 @@ class AuthDialog : public wxDialog { public: AuthDialog(const wxString &cert_filename, const wxString &ca_filename); virtual ~AuthDialog(); - - /* - // event handlers (these functions should _not_ be virtual) - void OnQuit(wxCommandEvent &event); - void OnAbout(wxCommandEvent &event); - */ + + void run_clicked(wxCommandEvent &event); + void view_cert_clicked(wxCommandEvent &event); + void cancel_clicked(wxCommandEvent &event); private: void read_cert_file(const wxString &cert_filename); @@ -73,7 +71,7 @@ private: private: // any class wishing to process wxWidgets events must use this macro - // DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() X509 *_cert; STACK *_stack; diff --git a/direct/src/plugin/p3dInstance.cxx b/direct/src/plugin/p3dInstance.cxx index 087091f731..f7d2473547 100644 --- a/direct/src/plugin/p3dInstance.cxx +++ b/direct/src/plugin/p3dInstance.cxx @@ -220,8 +220,8 @@ set_p3d_url(const string &p3d_url) { // Maybe it's time to open a splash window now. make_splash_window(); - // Mark the time we started downloading, so we'll know when to set - // the install label. + // Mark the time we started downloading, so we'll know when to reveal + // the progress bar. #ifdef _WIN32 _start_dl_instance_tick = GetTickCount(); #else