예제 #1
0
 def OnLinkClicked(self, linkinfo):
     href = linkinfo.GetHref()
     if href == 'show_license':
         from wxPython.lib.dialogs import wxScrolledMessageDialog
         try:
             license = open(os.path.join(path,
                                         'license.txt'))
             dlg = wxScrolledMessageDialog(self, license.read(),
                                           "Hangman-si-ta - License")
             license.close()
             dlg.ShowModal()
             dlg.Destroy()
         except IOError:
             wxMessageBox("Can't find the license!\n"
                          "You can get a copy at \n"
                          "http://www.opensource.org/licenses/"
                          "mit-license.php", "Error",
                          wxOK | wxCENTRE | wxICON_EXCLAMATION)
     elif href == 'show_credits':
         from wxPython.lib.dialogs import wxScrolledMessageDialog
         try:
             credits = open(os.path.join(path,
                                         'credits.txt'))
             dlg = wxScrolledMessageDialog(self, credits.read(),
                                           "Hgnmang-si-ta - Credits")
             credits.close()
             dlg.ShowModal()
             dlg.Destroy()
         except IOError:
             wxMessageBox("Can't find the credits file!\n", "Oops!",
                          wxOK | wxCENTRE | wxICON_EXCLAMATION)
     else:
         import webbrowser
         webbrowser.open(linkinfo.GetHref(), new=True)
예제 #2
0
 def show_license(event):
     f = open("COPYING")
     m = f.read()
     dlg = wxScrolledMessageDialog(self,
                                   m,
                                   "pyXede License",
                                   size=(640, 400))
     dlg.ShowModal()
예제 #3
0
 def OnViewSource(self, event):
     source = self.html.GetParser().GetSource()
     dlg = wxScrolledMessageDialog(self, source, 'HTML Source')
     dlg.ShowModal()
     dlg.Destroy()
예제 #4
0
 def OnViewSource(self, event):
     source = self.html.GetParser().GetSource()
     dlg = wxScrolledMessageDialog(self, source, "HTML Source")
     dlg.ShowModal()
     dlg.Destroy()
예제 #5
0
    def FullCommit(self):
        """Does the whole repoman CVS commit dealio"""

        try:
            cur_dir = os.getcwd()
        except:
            cur_dir = self.overlay_dir
        
        busy = wxBusyInfo("Copying ebuild and creating digest...")

        if self.newPackage:
            try:
                os.chdir("%s/%s" % (self.cvsRoot, self.category))
            except:
                utils.write(self.parent, "!!! Failed to cd to %s/%s" % \
                            (self.cvsRoot, self.category))
                utils.write(self.parent, "!!! Check your CVS directory setting in Developer Preferences under the Options menu.")
                utils.write(self.parent, "!!! Aborted CVS commit.")
                return

            if (self.CreateCVSdir()):
                utils.write(self.parent, "))) Created directory %s" % self.cvsEbuildDir)
            else:
                utils.write(self.parent, "!!! Failed to create %s" % self.cvsEbuildDir)
                utils.write(self.parent, "!!! Aborted CVS commit.")
                return

        if self.newPackage:
            # /usr/bin/cvs add package directory
            self.CVSAddDir()

        try:
            os.chdir(self.cvsEbuildDir)
        except:
            utils.write(self.parent, "!!! Failed to cd to %s" % self.cvsEbuildDir)
            utils.write(self.parent, "!!! Aborted CVS commit.")
            return


        if not self.newPackage:
            # /usr/bin/cvs update
            self.CVSupdate()

        # Copy ebuild from PORTDIR_OVERLAY to CVS_DIR
        self.CopyEbuild()
        utils.write(self.parent, "))) Ebuild copied to CVS dir")

        # /usr/bin/cvs add ebuild
        #self.CVSAdd(self.cvsEbuild)
        self.CVSAdd(os.path.basename(self.cvsEbuild))
        utils.write(self.parent, "))) Ebuild added to CVS repository")

        # Prompt user to copy any files from $FILESDIR to CVS_DIR/FILESDIR
        # /usr/bin/cvs add em all
        r = self.DoFilesdir()
        if r == "error":
            utils.write(self.parent, "!!! Aborted CVS commit.")
            return
        if r == 0:
            utils.write(self.parent, "))) No files from $FILESDIR to copy.")


        # Show dialog with metadata.xml in case they need to change it
        #  or create it

        if self.newPackage:
            busy = None
            if not os.path.exists("%s/metadata.xml" % self.overlay_dir):
                dlg = MetadataDialog.MetadataDialog(self.parent, -1, "metadata.xml", \
                                                   size=wxSize(350, 200), \
                                                   style = wxDEFAULT_DIALOG_STYLE \
                                                   )
                dlg.CenterOnScreen()
                v = dlg.ShowModal()
                if v == wxID_OK:
                    t = dlg.metadata_out.GetText()
                    try:
                        f = open("%s/metadata.xml" % self.cvsEbuildDir, "w")
                        f.write(t)
                        f.close()
                    except:
                        utils.write(self.parent, "!!! Failed to write metadata.xml.")
                        utils.write(self.parent, "%s/metadata.xml" % self.cvsEbuildDir)
                        utils.write(self.parent, "!!! Aborted CVS commit.")
                        return

            #if not self.CopyMetadata():
            #    utils.write(self.parent, "!!! Failed to copy metadata.xml.")
            #    utils.write(self.parent, "!!! Aborted CVS commit.")
            #    return
            self.FixPerms()
            busy = wxBusyInfo("Adding metadata...")
            self.CVSAdd("metadata.xml")

        self.FixPerms()
        # Create digest for ebuild (should auto-add to cvs)
        self.CreateDigest()
        wxYield()
        busy = None

        # echangelog dialog
        r = self.GetMsg("Enter echangelog message                                ", \
                    "Enter echangelog message")
        if r == 0:
            utils.write(self.parent, "!!! Aborted CVS commit.")
            return


        self.Echangelog(self.cmsg)

        if self.newPackage:
            self.CVSAdd("ChangeLog")

        wxYield()

        # Get commit message (could be same as echangelog msg)
        r = self.GetMsg("Enter CVS commit message                                ", \
                    "Enter CVS commit message")
        if r == 0:
            utils.write(self.parent, "!!! Aborted CVS commit.")
            return

        busy = wxBusyInfo("Running repoman full...")
        txt = self.SyncExecute("PORTDIR_OVERLAY=%s /usr/bin/repoman full" \
                                % self.cvsEbuildDir, 1, 1)
        busy=None
        dlg = wxScrolledMessageDialog(self.parent, txt, "repoman full")
        dlg.ShowModal()
        dlg.Destroy()

        wxYield()

        msg = "Happy with repoman full?\nDo you want to run:\n \
              /usr/bin/repoman --pretend commit -m " + self.cmsg

        if (utils.MyMessage(self.parent, msg, "repoman --pretend commit", "info", 1)):
            busy = wxBusyInfo("Running repoman --pretend commit...")
 
            txt = self.SyncExecute(('''PORTDIR_OVERLAY=%s /usr/bin/repoman --pretend commit -m "%s"''' % (self.cvsEbuildDir, self.cmsg)), 1, 1)
            busy=None
            dlg = wxScrolledMessageDialog(self.parent, txt, "repoman --pretend commit")
            dlg.ShowModal()
            dlg.Destroy()
        else:
            utils.write(self.parent, "!!! CVS commit Cancelled.")
            return

        wxYield()
        msg = 'Happy with repoman --pretend commit?\nDo you want to run:\n \
              /usr/bin/repoman commit -m %s\n\n \
              WARNING: This will actually COMMIT to CVS with repoman!' % self.cmsg

        if (utils.MyMessage(self.parent, msg, "repoman commit", "info", 1)):
            busy = wxBusyInfo("Running repoman commit...")
            self.SyncExecute('PORTDIR_OVERLAY=%s /usr/bin/repoman commit -m %s' % (self.cvsEbuildDir, self.cmsg))
            busy=None
            wxYield()
            utils.write(self.parent,"))) Repoman commit finished.")
        else:
            utils.write(self.parent, "!!! CVS commit Cancelled.")

        # go back to overlay dir
        try:
            os.chdir(cur_dir)
        except:
            pass
예제 #6
0
파일: wxgui.py 프로젝트: harshadura/libmut
 def show_license(event):
     f = open("COPYING")
     m = f.read()
     dlg = wxScrolledMessageDialog(self, m , "pyXede License",
                                   size=(640,400))
     dlg.ShowModal()