コード例 #1
0
 def test_all_js_placeholders_removed(self):
     """Check to see if all of the JavaScript placeholders have been replaced."""
     placeholders = ["IMAGE_SRC_INSTALLED"]
     page = StartPage.handle()
     for placeholder in placeholders:
         self.assertNotIn(
             placeholder, page,
             "{} was not removed from the JS".format(placeholder))
コード例 #2
0
ファイル: PageManager.py プロジェクト: mazurikes/VPCreator
 def init_pages(self):
     self.Start = StartPage(self.ui)
     self.SelectFile = SelectFilePage(self.ui)
     self.MemoryType = MemoryTypePage(self.ui)
     self.WithoutECC = WithoutEccPage(self.ui)
     self.EccAdress = EccAdressPage(self.ui)
     self.BanksType = BanksTypePage(self.ui)
     self.JointBanks = JointBanksPage(self.ui)
     self.SeparatedBanks = SeparatedBanksPage(self.ui)
     self.DestinationFolder = DestinationFolderPage(self.ui)
     self.Result = ResultPage(self.ui)
コード例 #3
0
    def test_all_css_placeholders_removed(self):
        """Check to see if all of the CSS placeholders have been replaced."""
        placeholders = [
            "BACKGROUND", "BGTCOLOR", "FONTFAMILY", "FONTSIZE", "LINKCOLOR",
            "TEXTCOLOR", "BOXCOLOR", "BASECOLOR", "SHADOW"
        ]

        page = StartPage.handle()
        for placeholder in placeholders:
            self.assertNotIn(
                placeholder, page,
                "{} was not removed from the CSS".format(placeholder))
コード例 #4
0
    def test_files_do_not_contain_backslashes(self):
        # This would be caught by the W3C validator if we didn't sanitize the filenames before sending them.
        page = StartPage.handle()
        fileRE = re.compile(r'"file:///(.*?)"')
        results = fileRE.findall(string=page)

        badFilenames = []
        for result in results:
            if result.find("\\") != -1:
                badFilenames.append(result)

        if len(badFilenames) > 0:
            self.fail(
                "The following filenames contain backslashes, which is prohibited in HTML: {}"
                .format(badFilenames))
コード例 #5
0
ファイル: Klijent.py プロジェクト: sanjarancic/Ftp_Klijent
    def __init__(self, *args, **kwargs):
        Tk.__init__(self, *args, **kwargs)
        page_container = Frame(self)
        page_container.pack(side="top", fill="both", expand=True)
        page_container.grid_rowconfigure(0, weight=1)
        page_container.grid_columnconfigure(0, weight=1)

        self.pages = {
            'start': StartPage(page_container, self),
            'login': LoginPage(page_container, self),
            'register': RegisterPage(page_container, self),
            'access_via_link': DrivePage(page_container, self, False, False),
            'premium_user_drive': DrivePage(page_container, self, True, True),
            'regular_user_drive': DrivePage(page_container, self, False, True)
        }

        for page in self.pages.values():
            page.grid(row=0, column=0, sticky='nsew')

        self.show_page('start')
コード例 #6
0
 def test_all_html_placeholders_removed(self):
     """Check to see if all of the HTML placeholders have been replaced."""
     placeholders = [
         "T_TITLE", "VERSIONSTRING", "T_DOCUMENTS", "T_HELP", "T_ACTIVITY",
         "SECTION_RECENTFILES", "T_TIP", "T_ADJUSTRECENT",
         "SECTION_EXAMPLES", "SECTION_CUSTOM", "T_CUSTOM", "T_NOTES",
         "T_GENERALDOCUMENTATION", "IMAGE_SRC_USERHUB", "T_USERHUB",
         "T_DESCR_USERHUB", "IMAGE_SRC_POWERHUB", "T_POWERHUB",
         "T_DESCR_POWERHUB", "IMAGE_SRC_DEVHUB", "T_DEVHUB",
         "T_DESCR_DEVHUB", "IMAGE_SRC_MANUAL", "T_MANUAL", "T_DESCR_MANUAL",
         "T_WBHELP", "T_DESCR_WBHELP", "UL_WORKBENCHES", "T_COMMUNITYHELP",
         "T_DESCR_COMMUNITYHELP1", "T_DESCR_COMMUNITYHELP2",
         "T_DESCR_COMMUNITYHELP3", "T_ADDONS", "T_DESCR_ADDONS",
         "T_OFFLINEPLACEHOLDER", "T_OFFLINEHELP", "T_EXTERNALLINKS",
         "T_RECENTCOMMITS", "T_DESCR_RECENTCOMMITS", "T_EXTERNALLINKS",
         "T_SEEONGITHUB", "T_FORUM", "T_DESCR_FORUM"
     ]
     page = StartPage.handle()
     for placeholder in placeholders:
         self.assertNotIn(
             placeholder, page,
             "{} was not removed from the HTML".format(placeholder))
コード例 #7
0
#*                                                                         *
#*   This program is distributed in the hope that it will be useful,       *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Library General Public License for more details.                  *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with this program; if not, write to the Free Software   *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#***************************************************************************

import FreeCAD,FreeCADGui,os,sys
if sys.version_info.major < 3:
    from urrlib import unquote
else:
    from urllib.parse import unquote
# filename will be given before this script is run
cfolder = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").GetString("ShowCustomFolder","")
if cfolder:
    if not os.path.isdir(cfolder):
        cfolder = os.path.dirname(cfolder)
    f = unquote(filename).replace("+"," ")
    FreeCAD.open(os.path.join(cfolder,f))
    FreeCADGui.activeDocument().sendMsgToViews("ViewFit")

    from StartPage import StartPage
    StartPage.postStart()
    
コード例 #8
0
from CompanyManagement import CompanyManagement
from StartPage import StartPage

if __name__ == "__main__":
    CompanyManagement.import_data()

    window = StartPage()
    window.mainloop()
コード例 #9
0
import WebGui
from StartPage import StartPage
WebGui.openBrowserHTML(
    StartPage.handle(),
    'file://' + App.getResourceDir() + 'Mod/Start/StartPage/', 'Start page')
App.setActiveDocument("Unnamed")
App.ActiveDocument = App.getDocument("Unnamed")
Gui.ActiveDocument = Gui.getDocument("Unnamed")
from FreeCAD import Vector
from pyooml import *
a1 = -60
a2 = 70
L1 = 40
L2 = 40
v1 = Vector(L1, 0, 0)
v2 = Vector(L2, 0, 0)
f0 = frame()
f1 = frame()
f2 = frame()
sv1 = svector(v1).color("yellow")
sv2 = svector(v2).color("yellow")
import HMatrix
Ma = HMatrix.Roty(a1)
Mb = HMatrix.Translation(v1)
Mc = HMatrix.Roty(a2)
Md = HMatrix.Translation(v2)
sv1.T = Ma
f1.T = Ma * Mb
sv2.T = Ma * Mb * Mc
f2.T = Ma * Mb * Mc * Md
vr = f2.T.multiply(Vector(0, 0, 0))
コード例 #10
0
ファイル: Main.py プロジェクト: AndreaDagg/DecisIonCAr
from StartPage import StartPage
StartPage()
コード例 #11
0
    def test_html_validates(self):
        # Send the generated html to the W3C validator for analysis (removing potentially-sensitive data first)
        import urllib.request
        import os
        import json
        page = self.sanitize(
            StartPage.handle())  # Remove potentially sensitive data

        # For debugging, if you want to ensure that the sanitization worked correctly:
        # from pathlib import Path
        # home = str(Path.home())
        # f=open(home+"/test.html", "w")
        # f.write(page)
        # f.close()

        validation_url = "https://validator.w3.org/nu/?out=json"
        data = page.encode('utf-8')  # data should be bytes
        req = urllib.request.Request(validation_url, data)
        req.add_header("Content-type", "text/html; charset=utf-8")
        errorCount = 0
        warningCount = 0
        infoCount = 0
        validationResultString = ""
        try:
            with urllib.request.urlopen(req) as response:
                text = response.read()

                responseJSON = json.loads(text)

                for message in responseJSON["messages"]:
                    if "type" in message:
                        if message["type"] == "info":
                            if "subtype" in message:
                                if message["subtype"] == "warning":
                                    warningCount += 1
                                    validationResultString += "WARNING: {}\n".format(
                                        ascii(message["message"]))
                            else:
                                infoCount += 1
                                validationResultString += "INFO: {}\n".format(
                                    ascii(message["message"]))
                        elif message["type"] == "error":
                            errorCount += 1
                            validationResultString += "ERROR: {}\n".format(
                                ascii(message["message"]))
                        elif message["type"] == "non-document-error":
                            FreeCAD.Console.PrintWarning(
                                "W3C validator returned a non-document error:\n {}"
                                .format(message))
                            return

        except urllib.error.HTTPError as e:
            FreeCAD.Console.PrintWarning(
                "W3C validator returned response code {}".format(e.code))

        except urllib.error.URLError:
            FreeCAD.Console.PrintWarning(
                "Could not communicate with W3C validator")

        if errorCount > 0 or warningCount > 0:
            StartPage.exportTestFile()
            FreeCAD.Console.PrintWarning(
                "HTML validation failed: Start page source written to your home directory for analysis."
            )
            self.fail(
                "W3C Validator analysis shows the Start page has {} errors and {} warnings:\n\n{}"
                .format(errorCount, warningCount, validationResultString))
        elif infoCount > 0:
            FreeCAD.Console.PrintWarning(
                "The Start page is valid HTML, but the W3C sent back {} informative messages:\n{}."
                .format(infoCount, validationResultString))
コード例 #12
0
from StartPage import StartPage
if __name__ == '__main__':
    NewWindow1 = StartPage()
コード例 #13
0
ファイル: PageManager.py プロジェクト: mazurikes/Hex-Splitter
 def init_pages(self):
     self.Start = StartPage(self.all_ui)
     self.Main = MainPage(self.all_ui)
     self.Sucsess = SucsessPage(self.all_ui)