def load_terms_and_conditions(config):
    base_dir = 'terms_and_conditions'
    language = config.get('language', 'en_UK')
    path = resource_path(base_dir, f'{language}.html')
    if not os.path.exists(path):
        path = resource_path(base_dir, 'en_UK.html')
        if not os.path.exists(path):
            raise FileNotFoundError(f'Cannot open {path}')
    with open(path, 'r', encoding='utf-8') as file:
        return file.read()
Пример #2
0
    def dice_start(self, event, args):
        print("dice_start called")
        if not (args == None) and args["type"] == "dice":
            self.anim_dice1 = QMovie(
                resource_path("gui", "animations", "dice", "rolling" + ".gif"))
            self.anim_dice2 = QMovie(
                resource_path("gui", "animations", "dice", "rolling" + ".gif"))

            self.lbl_dice_header_img.setVisible(False)
            self.lbl_dice1.setVisible(True)
            self.lbl_dice2.setVisible(True)

            self.lbl_dice1.setMovie(self.anim_dice1)
            self.lbl_dice2.setMovie(self.anim_dice1)
            self.anim_dice1.start()
            self.anim_dice2.start()
Пример #3
0
    def roll_dice(self, event, result):
        #only play animation once per block, because multiple result in single block is same
        if self.dice_block == result["blockHeight"]:
            return

        self.dice_block = result["blockHeight"]
        dice1 = str(result["betInfo"]["firstDice"])
        dice2 = str(result["betInfo"]["secondDice"])
        self.anim_dice1.stop()
        self.anim_dice2.stop()

        self.anim_dice1.setFileName(
            resource_path("gui", "animations", "dice",
                          "dice" + dice1 + ".gif"))
        self.anim_dice2.setFileName(
            resource_path("gui", "animations", "dice",
                          "dice" + dice2 + ".gif"))

        def stop_dice1(frame_no):
            if frame_no == self.anim_dice1.frameCount() - 2:
                self.anim_dice1.stop()

        def stop_dice2(frame_no):
            if frame_no == self.anim_dice2.frameCount() - 2:
                self.anim_dice2.stop()

        self.anim_dice1.frameChanged.connect(stop_dice1)
        self.anim_dice2.frameChanged.connect(stop_dice2)

        self.anim_dice1.setCacheMode(QMovie.CacheAll)
        self.anim_dice2.setCacheMode(QMovie.CacheAll)

        self.lbl_dice1.setMovie(self.anim_dice1)
        self.lbl_dice2.setMovie(self.anim_dice2)

        self.anim_dice1.start()
        self.anim_dice2.start()
Пример #4
0
def icon_path(icon_basename):
    return resource_path('gui', 'icons', icon_basename)
Пример #5
0
def icon_path(icon_basename):
    return resource_path('gui', 'icons', icon_basename)
Пример #6
0
def image_path(image_basename):
    return resource_path('gui', 'images', image_basename)