コード例 #1
0
    def makeImpl(self, test, mask_pattern):
        self.modules_count = self.version * 4 + 17
        self.modules = [None] * self.modules_count

        for row in range(self.modules_count):

            self.modules[row] = [None] * self.modules_count

            for col in range(self.modules_count):
                self.modules[row][col] = None   # (col + row) % 3

        self.setup_position_probe_pattern(0, 0)
        self.setup_position_probe_pattern(self.modules_count - 7, 0)
        self.setup_position_probe_pattern(0, self.modules_count - 7)
        self.sutup_position_adjust_pattern()
        self.setup_timing_pattern()
        self.setup_type_info(test, mask_pattern)

        if self.version >= 7:
            self.setup_type_number(test)

        if self.data_cache is None:
            self.data_cache = util.create_data(
                self.version, self.error_correction, self.data_list)
        self.map_data(self.data_cache, mask_pattern)
コード例 #2
0
    def makeImpl(self, test, mask_pattern):
        util.check_version(self.version)
        self.modules_count = self.version * 4 + 17

        if self.version in precomputed_qr_blanks:
            self.modules = copy_2d_array(precomputed_qr_blanks[self.version])
        else:
            self.modules = [None] * self.modules_count

            for row in range(self.modules_count):
                self.modules[row] = [None] * self.modules_count

            self.setup_position_probe_pattern(0, 0)
            self.setup_position_probe_pattern(self.modules_count - 7, 0)
            self.setup_position_probe_pattern(0, self.modules_count - 7)
            self.setup_position_adjust_pattern()
            self.setup_timing_pattern()

            precomputed_qr_blanks[self.version] = copy_2d_array(self.modules)

        self.setup_type_info(test, mask_pattern)

        if self.version >= 7:
            self.setup_type_number(test)

        if self.data_cache is None:
            self.data_cache = util.create_data(self.version,
                                               self.error_correction,
                                               self.data_list)
        self.map_data(self.data_cache, mask_pattern)
コード例 #3
0
ファイル: main.py プロジェクト: assafnativ/python-qrcode
    def makeImpl(self, test, mask_pattern, use_colors=True):
        _check_version(self.version)
        self.modules_count = self.version * 4 + 17
        self.modules = [None] * self.modules_count

        for row in range(self.modules_count):

            self.modules[row] = [None] * self.modules_count

            for col in range(self.modules_count):
                self.modules[row][col] = None   # (col + row) % 3

        self.setup_position_probe_pattern(0, 0, use_colors=use_colors)
        self.setup_position_probe_pattern(self.modules_count - 7, 0, use_colors=use_colors)
        self.setup_position_probe_pattern(0, self.modules_count - 7, use_colors=use_colors)
        self.setup_position_adjust_pattern(use_colors=use_colors)
        self.setup_timing_pattern(use_colors=use_colors)
        self.setup_type_info(test, mask_pattern, use_colors=use_colors)

        if self.version >= 7:
            self.setup_type_number(test, use_colors=use_colors)

        if self.data_cache is None:
            self.data_cache = util.create_data(
                                    self.version,
                                    self.error_correction,
                                    self.data_list,
                                    self.colors,
                                    self.control_colors,
                                    copy_colors_to_ec=self.copy_colors_to_ec)
        self.map_data(self.data_cache, mask_pattern, use_colors=use_colors)
コード例 #4
0
ファイル: main.py プロジェクト: nimnull/qrcode
 def best_fit(self, start=None):
     """
     Find the minimum size required to fit in the data.
     """
     size = start or 1
     while True:
         try:
             self.data_cache = util.create_data(size, self.error_correction, self.data_list)
         except exceptions.DataOverflowError:
             size += 1
         else:
             self.version = size
             return size
コード例 #5
0
 def best_fit(self, start=None):
     """
     Find the minimum size required to fit in the data.
     """
     size = start or 1
     while True:
         try:
             self.data_cache = util.create_data(size, self.error_correction,
                                                self.data_list)
         except exceptions.DataOverflowError:
             size += 1
         else:
             self.version = size
             return size
コード例 #6
0
ファイル: BarCode.py プロジェクト: SeMcFly/QRCode
 def addData(self, data):
     self.listData.append(util.QRData(data))
     self.dataEncode = util.create_data(self.version, 1, self.listData)