コード例 #1
0
ファイル: WineVersionsWindow.py プロジェクト: yieyu/POL-POM-4
    def AutoReload(self, event):
        reload32 = os.listdir(Variables.playonlinux_rep + "/wine/" +
                              fetchUserOS() + "-x86")
        if (os.environ["AMD64_COMPATIBLE"] == "True"):
            reload64 = os.listdir(Variables.playonlinux_rep + "/wine/" +
                                  fetchUserOS() + "-amd64")
        if (self.download32.thread_message == "Ok"
                or self.download32.thread_message == "Err"):
            self.WriteVersion()
            self.download32.thread_message = "Wait"

        if (os.environ["AMD64_COMPATIBLE"] == "True"):
            if (self.download64.thread_message == "Ok"
                    or self.download64.thread_message == "Err"):
                self.WriteVersion("amd64")
                self.download64.thread_message = "Wait"

        if (os.environ["AMD64_COMPATIBLE"] == "True"):
            if (reload64 != self.oldreload64):
                self.getVersions("amd64")
                self.oldreload64 = reload64

        if (reload32 != self.oldreload32):
            self.getVersions()
            self.oldreload32 = reload32

        if (self.download32.versions != self.oldversions32):
            self.oldversions32 = self.download32.versions[:]

        if (os.environ["AMD64_COMPATIBLE"] == "True"):
            if (self.download64.versions != self.oldversions64):
                self.oldversions64 = self.download64.versions[:]
コード例 #2
0
    def run(self):
        self.thread_running = True
        while (self.thread_running):
            if (self.thread_message == "get"):
                try:
                    url = os.environ["WINE_SITE"]
                    wfolder = "-".join([fetchUserOS(), self.architecture])

                    req = urllib2.Request(url, None,
                                          {'User-Agent': Variables.userAgent})
                    handle = urllib2.urlopen(req, timeout=5)
                    time.sleep(1)
                    available_distributions = json.loads(handle.read())
                    self.versions_ = []
                    for distribution in available_distributions:
                        if (distribution["name"] == "-".join(
                            ["upstream",
                             fetchUserOS(), self.architecture])):
                            for package in distribution["packages"]:
                                version = package["version"]
                                packageUrl = package["url"]
                                sha1sum = package["sha1sum"]
                                if (not os.path.exists(
                                        Variables.playonlinux_rep + "/wine/" +
                                        wfolder + "/" + version)):
                                    self.versions_.append(version)
                                else:
                                    print("Directory: %s exists" %
                                          (Variables.playonlinux_rep +
                                           "/wine/" + wfolder + "/" + version))
                        elif (distribution["name"] == "-".join(
                            ["staging",
                             fetchUserOS(), self.architecture])):
                            for package in distribution["packages"]:
                                version = package["version"]
                                if (not os.path.exists(
                                        Variables.playonlinux_rep + "/wine/" +
                                        wfolder + "/" + version + "-staging")):
                                    self.versions_.append(version + "-staging")
                                else:
                                    print(
                                        "Directory: %s exists" %
                                        (Variables.playonlinux_rep + "/wine/" +
                                         wfolder + "/" + version + "-staging"))
                        else:
                            print(distribution["name"] + " does not match")

                    self.versions_.sort(key=keynat)
                    self.versions_.reverse()
                    self.versions = self.versions_[:]
                    self.thread_message = "Ok"
                except Exception, e:
                    print(e)
                    time.sleep(1)
                    self.thread_message = "Err"
                    self.versions = ["Wine packages website is unavailable"]

            else:
                time.sleep(0.2)
コード例 #3
0
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          title,
                          size=(750, 400 + Variables.windows_add_size),
                          style=wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX)
        self.timer = wx.Timer(self, 1)
        self.SetIcon(
            wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png",
                    wx.BITMAP_TYPE_ANY))
        self.wine_version_fetcher = WineVersionFetcher(fetchUserOS())

        self.notebook = WineVersionsNotebook(self)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.notebook, 15, wx.EXPAND | wx.ALL, 2)

        for available_arch in fetch_supported_archs():
            self.notebook.add_architecture_tab(available_arch)

        self.last_checksum = None
        self.notebook.on_install_handler = self.install_wine_version
        self.notebook.on_remove_handler = self.remove_wine_version

        self.Bind(wx.EVT_TIMER, self.detect_changes, self.timer)
        self.timer.Start(1000)
コード例 #4
0
    def run(self):
        self.thread_running = True
        while(self.thread_running):
            if(self.thread_message == "get"):
                try :
                    url = os.environ["WINE_SITE"]
                    wfolder = "-".join([fetchUserOS(), self.architecture])


                    req = urllib2.Request(url, None, {'User-Agent': Variables.userAgent})
                    handle = urllib2.urlopen(req, timeout = 5)
                    time.sleep(1)
                    available_distributions = json.loads(handle.read())
                    self.versions_ = []
                    for distribution in available_distributions:
                        if(distribution["name"] == "-".join(["upstream", fetchUserOS(), self.architecture])):
                            for package in distribution["packages"]:
                                version = package["version"]
                                packageUrl = package["url"]
                                sha1sum = package["sha1sum"]
                                if(not os.path.exists(Variables.playonlinux_rep+"/wine/"+wfolder+"/"+version)):
                                    self.versions_.append(version)
                                else:
                                    print("Directory: %s exists" % (Variables.playonlinux_rep+"/wine/"+wfolder+"/"+version))
                        elif(distribution["name"] == "-".join(["staging", fetchUserOS(), self.architecture])):
                            for package in distribution["packages"]:
                                version = package["version"]
                                if(not os.path.exists(Variables.playonlinux_rep+"/wine/"+wfolder+"/"+version+"-staging")):
                                    self.versions_.append(version+"-staging")
                                else:
                                    print("Directory: %s exists" % (Variables.playonlinux_rep+"/wine/"+wfolder+"/"+version+"-staging"))
                        else:
                            print(distribution["name"] + " does not match")

                    self.versions_.sort(key=keynat)
                    self.versions_.reverse()
                    self.versions = self.versions_[:]
                    self.thread_message = "Ok"
                except Exception, e:
                    print(e)
                    time.sleep(1)
                    self.thread_message = "Err"
                    self.versions = ["Wine packages website is unavailable"]

            else:
                time.sleep(0.2)
コード例 #5
0
 def remove_wine_version(self, architecture, version):
     used_version = self.checkVersionUse(
         architecture)  # Get the set of wine version used by wineprefix
     message = _('Are you sure you want to delete wine {0}?').format(
         version)
     if version in used_version:
         message += "\n" + _('This version is CURRENTLY IN USE')
     if (wx.YES == wx.MessageBox(message,
                                 os.environ["APPLICATION_TITLE"],
                                 style=wx.YES_NO | wx.ICON_QUESTION)):
         shutil.rmtree(Variables.playonlinux_rep + "/wine/" +
                       fetchUserOS() + "-" + architecture + "/" + version)
コード例 #6
0
ファイル: WineVersionsWindow.py プロジェクト: yieyu/POL-POM-4
 def delete_common(self, event, arch):
     version = self.onglets.installedWineVersionsTreeSelector[
         arch].GetItemText(
             self.onglets.installedWineVersionsTreeSelector[arch].
             GetSelection()).encode("utf-8", "replace")
     used_version = self.checkVersionUse(
         arch)  # Get the set of wine version used by wineprefix
     message = _('Are you sure you want to delete wine {0}?').format(
         version)
     if version in used_version:
         message += "\n" + _('This version is CURRENTLY IN USE')
     if (wx.YES == wx.MessageBox(message.decode("utf-8", "replace"),
                                 os.environ["APPLICATION_TITLE"],
                                 style=wx.YES_NO | wx.ICON_QUESTION)):
         shutil.rmtree(Variables.playonlinux_rep + "/wine/" +
                       fetchUserOS() + "-" + arch + "/" + version)
コード例 #7
0
    def _sync_fetch_all_installed_wine_version(self):
        architectures = {}
        for architecture in fetch_supported_archs():
            wine_folder = fetchUserOS() + "-" + architecture

            if os.path.exists(Variables.playonlinux_rep + "/wine/" +
                              wine_folder):
                available_versions = [{
                    "name": version,
                } for version in os.listdir(Variables.playonlinux_rep +
                                            "/wine/" + wine_folder)
                                      if version != "installing"]
            else:
                available_versions = []

            if architecture not in architectures:
                architectures[architecture] = []

            architectures[architecture] += available_versions
        return architectures
コード例 #8
0
ファイル: WineVersionsWindow.py プロジェクト: yieyu/POL-POM-4
    def WriteVersion(self, arch="x86"):
        self.onglets.imagesapps[arch].RemoveAll()
        self.onglets.imagesapps_i[arch].RemoveAll()
        self.onglets.availableWineVersionsTreeSelector[arch].DeleteAllItems()
        self.onglets.installedWineVersionsTreeSelector[arch].DeleteAllItems()

        root = self.onglets.availableWineVersionsTreeSelector[arch].AddRoot("")
        self.i = 0
        if (arch == "x86"):
            while (self.i < len(self.download32.versions)):
                self.onglets.imagesapps[arch].Add(
                    wx.Bitmap(Variables.playonlinux_env +
                              "/etc/install/wine-packages.png"))
                self.onglets.availableWineVersionsTreeSelector[
                    arch].AppendItem(root, self.download32.versions[self.i],
                                     self.i)
                self.i += 1
        if (arch == "amd64"):
            while (self.i < len(self.download64.versions)):
                self.onglets.imagesapps[arch].Add(
                    wx.Bitmap(Variables.playonlinux_env +
                              "/etc/install/wine-packages.png"))
                self.onglets.availableWineVersionsTreeSelector[
                    arch].AppendItem(root, self.download64.versions[self.i],
                                     self.i)
                self.i += 1

        root2 = self.onglets.installedWineVersionsTreeSelector[arch].AddRoot(
            "")
        wfolder = fetchUserOS() + "-" + arch

        used_version = self.checkVersionUse(
            arch)  # Get the set of wine version used by wineprefix

        installed_versions = os.listdir(Variables.playonlinux_rep + "/wine/" +
                                        wfolder)
        installed_versions.sort(key=playonlinux.keynat)
        installed_versions.reverse()
        self.i = 0
        self.j = 0
        boldFont = self.GetFont()
        boldFont.SetWeight(wx.BOLD)
        while (self.i < len(installed_versions)):
            if (os.path.isdir(Variables.playonlinux_rep + "/wine/" + wfolder +
                              "/" + installed_versions[self.i])):
                itemId = self.onglets.installedWineVersionsTreeSelector[
                    arch].AppendItem(root2, installed_versions[self.i], self.j)
                if (len(
                        os.listdir(Variables.playonlinux_rep + "/wine/" +
                                   wfolder + "/" +
                                   installed_versions[self.i])) == 0):
                    self.onglets.imagesapps_i[arch].Add(
                        wx.Bitmap(Variables.playonlinux_env +
                                  "/etc/install/wine-warning.png"))
                elif installed_versions[self.i] not in used_version:
                    self.onglets.imagesapps_i[arch].Add(
                        wx.Bitmap(Variables.playonlinux_env +
                                  "/etc/install/wine.png"))
                else:  # Clearly show the wine version in use
                    self.onglets.imagesapps_i[arch].Add(
                        wx.Bitmap(Variables.playonlinux_env +
                                  "/etc/install/wine-in-use.png"))
                    self.onglets.installedWineVersionsTreeSelector[
                        arch].SetItemFont(itemId, boldFont)
                self.j += 1
            self.i += 1
        try:
            if (versions[0] == "Wine packages website is unavailable"):
                self.onglets.availableWineVersionsTreeSelector[arch].Enable(
                    False)
                self.onglets.imagesapps[arch].RemoveAll()
        except:
            pass
        self.onglets.button_rm[arch].Enable(False)
        self.onglets.button_in[arch].Enable(False)